This document assumes that the first page is send. aspx, and the second page is receive. aspx.
1. pass through URL link address
(1) send. asp code
Protected void button#click (object sender, EventArgs e) { Request. Redirect ("Default2.aspx? Username = honge "); } |
(2) receive. aspx code
String username = Request. QueryString ["username"]; // you can obtain the parameter value. |
2. POST Transmission
(1) send. asp code
<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 code
String username = Ruquest. Form ["receive"]; |
3. Session Transmission
(1) send. asp code
Protected void button#click (object sender, EventArgs e) { Session ["username"] = "honge "; Request. Redirect ("Default2.aspx "); } |
(2) receive. aspx code
String username = Session ["username"]; // you can obtain the parameter value. |
4. Application-Based Transmission
(1) send. asp code
Protected void button#click (object sender, EventArgs e) { Application ["username"] = "honge "; Request. Redirect ("Default2.aspx "); } |
(2) receive. aspx code
String username = Application ["username"]; To obtain the parameter value. |
5. Use Server. Transfer for Transmission
(1) send. asp code
Public string Name { Get { Return "honge "; } } Protected void button#click (object sender, EventArgs e) { Server. Transfer ("Default2.aspx "); } |
(2) receive. aspx code
Send d = Context. Handler as send; If (d! = Null) { Response. Write (d. Name); // you can obtain the parameter value. } |