<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" >
<%@ Import namespace= "System.Data.SqlClient"%>
<%@ Import namespace= "System.Data"%>
<HTML>
<HEAD>
<TITLE> Example of landing </TITLE>
<meta name= "Generator" content= "EditPlus" >
<meta name= "Author" content= "" >
<meta name= "Keywords" content= "" >
<meta name= "Description" content= "" >
<script language= "C #" runat= "Server" >
void Add_click (Object Sender,eventargs e)
{
String Str_id=tel1.text;
String Str_name=tel2.text;
session["id"]=str_name;
session["UserName"]=str_name;
SqlCommand mycommand;
String Myselect;
string [email protected] "server=localhost;uid=sa;pwd=;d atabase=test";
SqlConnection myconnection =new SqlConnection (myConnString);
Myconnection.open ();
Myselect= "SELECT * from test where id = '" +tel1.text+ "' and Name= '" +tel2.text+ "'";
Mycommand=new SqlCommand (myselect,myconnection);
SqlDataReader Reader=mycommand.executereader ();
SqlDataReader Reader=mycommand.executereader ();
if (tel1.text== "" | | tel2.text== "")
{
Label1.text= "The name of the school number cannot be empty";
}
else if (session["UserName"]!=null | | session["id"]!=null)
{
Label1.text= "You have landed";
}
else if (!reader. Read ())
{
label1.text= "Database no information!";
Reader. Close ();
}
Else
{
label1.text= "Landing Success";
label.text=session["Username"]. ToString ();
Reader. Close ();
Tel1.text= "";
Tel2.text= "";
session["UserName"]=str_name;;
session["id"]=str_id;
Response.Redirect ("first3.aspx");
}
Myconnection.close ();
}
</Script>
</HEAD>
<BODY>
<form runat= "Server" >
Study Number: <asp:textbox id= "Tel1" size= "" runat= "Server"/>
<p>
Name: <asp:textbox id= "Tel2" size= "" runat= "Server"/>
<p>
<asp:button id= "Add" onclick= "Add_click" runat= "server" text= "login" ></asp:Button>
<p>
<asp:label id= "Label1" runat= "Server"/>
</form>
</BODY>
</HTML>
Method: C # Login with session