1.Response: The server sends the client information, or the server transmits the output to the user.
Redirect: Let the client redirect to the specified URL.
Write: Writes out the specified string.
2.request: The client sends the server, or obtains the information from the client.
Form: Gets the value of a form element from a form that uses the Post submission method.
QueryString: Retrieves the variable value from the query string and applies to the form of get submit.
Take an example: a landing page, there is a main page. When the landing page is successful, it automatically jumps to the main page.
1.login.aspx
Copy Code code as follows:
<form id= "Form1" runat= "Server" method= "POST" >
<div>
<div>
<asp:label id= "Lbluser" runat= "server" text= "username" ></asp:Label>
<asp:textbox id= "Txtuser" runat= "Server" ></asp:TextBox>
</div>
<div></div>
<div>
<asp:label id= "lblpwd" runat= "server" text= "password" ></asp:Label>
<asp:textbox id= "txtpwd" runat= "Server" ></asp:TextBox>
</div>
<div>
<asp:button id= "Button1" runat= "server" text= "login" onclick= "button1_click" style= "width:40px"/>
</div>
</div>
</form>
Login.aspx.cs
Copy Code code as follows:
protected void Button1_Click (object sender, EventArgs e)
{
String user = Request.Form.Get ("Txtuser"). ToString ()//The client sends the server a user name to submit
string pwd = Request.Form.Get ("Txtpwd"). ToString (); The password the client sends the server to submit
if (user = = "1" && pwd = = "1")
{
Response.Redirect ("main.aspx?user=" + user); Jump to Main Page
}
Else
{
Response.Write ("Login Failed");
}
2.main.aspx.cs
Copy Code code as follows:
protected void Page_Load (object sender, EventArgs e)
{
String user = request.querystring["user"]. ToString ();//Get user username
Response.Write ("Welcome" + user + "login");
}
When the login page gets the correct username and password, the password jumps to the main page, and the home page prompts you for a successful login. When you enter an error, you will be prompted for a login failure.
Beef Brisket in the press release system, these two objects will often be used, I believe that in the future learning will be used more, the understanding will be more profound.