Asp.net Get and Post parameters, and asp.net Parameters
Asp.net Get and Post Parameters
Get request:
For parameter passing: test. aspx? Name = % e5 % bc % a0 % e4 % b8 % 89
Method for receiving parameters:
Request. QueryString ["name"]
HttpContext. Current. Request ["name"]
The parameters received by both are "Zhang San"
The two decode parameters when receiving them: HttpUtility. UrlDecode
Post request:
Method for receiving parameters:
Request. Form ["name"]
HttpContext. Current. Request ["name"]
The two parameters are decoded by default: HttpUtility. UrlDecode
If you want to upload special characters, such as + and &, You need to perform the encoding operation: HttpUtility. UrlEncode.
For example, you need to transmit a + B & c correctly.
String name = string. Format ("name = {0}", HttpUtility. UrlEncode ("a + B & c "));
...
Request. QueryString ["name"]
Request. Form ["name"]
HttpContext. Current. Request ["name"]
These parameters are decoded by default when they are received.