I. used:
(1) pass through the URL link address (add ?.. When multiple parameters are added, & para2 = value cannot contain spaces such as href = "receive. aspx? Username = honge & Pwd = 123 ")
Send. aspx:
// Or the page <a href = "receive. aspx? Username = honge "> </a>
Protected void button#click (Object sender, eventargs E)
{Request. Redirect ("receive. aspx? Username = honge ");}
Receive. aspx:
String username = request. querystring ["username"]; To obtain the parameter value.
PS1: The passed parameters are of the string type by default, so no quotation marks or type conversion are required before transmission. The receiver is of the string type. <excluding Chinese characters>
PS2: when multiple parameters are passed, separate them with &. Note that no space is allowed.
PS3: When passing Chinese characters, type conversion is often performed first. system. Web. httputility. urlencode ("Hello! ");
(2) Pass the session
Send. aspx:
Protected void button#click (Object sender, eventargs E)
{Session ["username"] = "honge"; request. Redirect ("default2.aspx ");}
Receive. aspx:
String username = session ["username"]; To obtain the parameter value.
(3) using Cook:
Send:
Request. Cookies. Add (New httpcookie ("cookie_stop2_class", "education "));
Receive:
Httpcookie mycook = request. Cookies ["cookie_stop2_class"];
If (mycook! = NULL ){
String STR = mycook. value; // STR = education;
}
(4) use application
Send. aspx:
Protected void button#click (Object sender, eventargs E)
{Application ["username"] = "honge"; request. Redirect ("default2.aspx ");}
Receive. aspx: String username = application ["username"]; To obtain the parameter value.
(5) Use server. Transfer
Send. aspx:
Public string name {get {return "honge ";}}
Protected void button#click (Object sender, eventargs E)
{Server. Transfer ("default2.aspx ");}
Receive. aspx:
Send d = context. handler as send;
If (D! = NULL) {response. Write (D. Name );}