Common aspx page pass-through Method 1, Get mode
Send page: <a href= "Requestpage.aspx?name=value" ></a>
Receive page: request["name"],request.querystring["name"],request.params["name"]
2. Post mode
Send page:
<form mathod= "POST" action= "requestpage.aspx" >
<input id= "id" name= "name" ></input>
<input type= "Submit" ></input>
</form> Receive page: request.form["name"]
3. Session and application save variables in session and application variables for the entire application to be called
session["Para1"]=value1;
application["Para2"]=value2;
Get the values stored in session and application
session["param1"];
application["Para2"];
4. Static variables
Send page: serverpage.aspx
public static string Name= "value";
protected void Page_Load (Object Sender,eventargs e)
{
Server.Transfer ("Requestpage.aspx?name=value");
}
Receive page: Serverpage.name;
Request to get the difference between page values request, Request.parames, Request.QueryString, Request.ServerVariables, Request.Form send page:
<form method= "POST" action= "requestpage.aspx?name=0000" >
<input type= "checkbox" name= "name" value= "Justice"/> Justice
<input type= "checkbox" name= "name" value= "handsome"/> Handsome
<input type= "Submit" value= "Submit"/>
</form>
Receive page:
- str1=request["Name"];
- str2=request.params["Name"];
- str3=request.querystring["Name"];
- str4=request.servervariables["Name"];
- str5=request.form["Name"];
Results Received:
- str1=0000
- STR2=0000, justice, handsome.
- str3=0000
- str4=
- Str5= Justice, handsome
For the interpretation of the received result:
- The request iterates through all the collections QueryString, Form, Cookies, ClientCertificate, servervarible until the name of the first matching value is found, and the collection is inefficient and unsafe. Stop finding when the first match is found, the general get type is higher than the post type priority, so str1 gets a get pass value of 0000;
- Request.QueryString gets the value of the get type, so the STR3 value is 0000;
- Request.Form Gets the post mode value, so the STR5 value is the table only son value justice, handsome;
- Request.params get Querystring+form+servervariable+cookies collection, so str2=0000, justice, handsome;
- Request.ServerVariables is to obtain the client-related information, such as IE type, IP address and so on, need to use specific parameters to obtain, such as request.servervariables["URL"] get the server address ; request.servervariables["Query_string"] gets the contents of the query string and so on.
The difference between request,request.querystring,request.params,request.form,request.servervariables