----------------text.aspx.cs-------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Be_test;
using Bl_Test;
namespace todayTest
{
public partial class log1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
protected void btnlogin_Click(object sender, EventArgs e)
{
BEtest be = new BEtest();
be.Name = txtname.Text;
be.address = txtPassword.Text;
var n = new BLtest().show().Where(id=>id.Name==txtname.Text && id.address==txtPassword.Text);
if (n.Count() != 0)
{
Session["Name"] = txtname.Text;
Session["address"] = txtPassword.Text;
Response.Redirect("rAnG.aspx");
}
else {
lbllog.Text = "Username 0r Password wrong";
}
}
}
}
------------------------test.aspx------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="login.aspx.cs" Inherits="testasp.login" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="TextBox1" runat="server" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
<table class="auto-style1">
<tr>
<td>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="TextBox2" runat="server" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
</td>
<td> </td>
</tr>
</table>
<div>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Be_test;
using Bl_Test;
namespace todayTest
{
public partial class log1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
protected void btnlogin_Click(object sender, EventArgs e)
{
BEtest be = new BEtest();
be.Name = txtname.Text;
be.address = txtPassword.Text;
var n = new BLtest().show().Where(id=>id.Name==txtname.Text && id.address==txtPassword.Text);
if (n.Count() != 0)
{
Session["Name"] = txtname.Text;
Session["address"] = txtPassword.Text;
Response.Redirect("rAnG.aspx");
}
else {
lbllog.Text = "Username 0r Password wrong";
}
}
}
}
------------------------test.aspx------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="login.aspx.cs" Inherits="testasp.login" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="TextBox1" runat="server" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
<table class="auto-style1">
<tr>
<td>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ControlToValidate="TextBox2" runat="server" ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidator>
</td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
</td>
<td> </td>
</tr>
</table>
<div>
</div>
</form>
</body>
</html>
No comments :
Post a Comment