Asp. NET provides us with three ways, one can pass the corresponding value by using QueryString , another is to pass the corresponding value through the session variable, and also through Server.Transfer method to implement.
Using QueryString
QueryString is a very simple way of passing values, and the disadvantage is that the value to be transferred is displayed in the address bar of the browser, and the object cannot be passed in this method. This approach is best if you want to pass a security that is not so important or a simple value.
1. Create a Web Form
2. Place a button1 in the new Web form, placing two Textbox1,textbox2
3. Create Click events for button buttons.
The code is as follows:
private void Button_Click (Object Sender,system.eventargs e)
{
string URL;
Url= "webform2.aspx?name=" +textbox1.text + "&am email=" +textbox2.text;
Response.Redirect (URL);
}
4. Create a new target page named WebForm2
5. Place two Label1,label2 in WebForm2
Add the following code to the WebForm2 Page_Load:
private void Page_Load (Object Sender,system.eventargs e)
{
label1.text=request.querystring["name"];
label2.text=request.querystring["Email"];
}
Response-Response Request Object
Response.Redirect (path); -redirect
Response.Write ("AAAA"); -Output content
Server.Transfer (path);
Request-Get requested object request["key"-Return by default is string type
Webform_ cross-page pass-through values