Before writing, assume that the first page is send. aspx, and the second page is receive. aspx.
1. pass through URL link address
(1) Send. asp Code
Copy code The Code is as follows: protected void button#click (Object sender, eventargs E)
{
Request. Redirect ("default2.aspx? Username = honge ");
}
(2) receive. aspx codeCopy codeThe Code is as follows: String username = request. querystring ["username"]; // you can obtain the parameter value.
2. Post Transmission
(1) Send. ASP codeCopy codeThe Code is as follows: <Form ID = "form1" runat = "server" Action = "receive. aspx" method = post>
<Div>
<Asp: button id = "button1" runat = "server" onclick = "button#click" text = "button"/>
<Asp: textbox id = "username" runat = "server"> </ASP: textbox>
</Div>
</Form>
(2) receive. aspx codeCopy codeThe Code is as follows: String username = ruquest. Form ["receive"];
3. Session Transmission
(1) Send. ASP codeCopy codeThe Code is as follows: protected void button#click (Object sender, eventargs E)
{
Session ["username"] = "honge ";
Request. Redirect ("default2.aspx ");
}
(2) receive. aspx codeCopy codeThe Code is as follows: String username = session ["username"]; // you can obtain the parameter value.
4. Application-Based Transmission
(1) Send. ASP codeCopy codeThe Code is as follows: protected void button#click (Object sender, eventargs E)
{
Application ["username"] = "honge ";
Request. Redirect ("default2.aspx ");
}
(2) receive. aspx codeCopy codeThe Code is as follows: String username = application ["username"]; To obtain the parameter value.
5. Use server. Transfer for Transmission
(1) Send. ASP codeCopy codeThe Code is as follows: public string name
{
Get {
Return "honge ";
}
}
Protected void button#click (Object sender, eventargs E)
{
Server. Transfer ("default2.aspx ");
}
(2) receive. aspx Code copy Code the code is as follows: send d = context. handler as send;
If (D! = NULL)
{< br> response. Write (D. Name); // you can obtain the parameter value.
}