The encoded url is correct. If it can be uploaded to another page, an error will occur and garbled characters will appear in the address bar.
1. Set the web. config file
Copy codeThe Code is as follows:
<System. web>
<Globalization requestEncoding = "gb2312" responseEncoding = "gb2312" culture = "zh-CN" fileEncoding = "gb2312"/>
</System. web>
2.asp.net
Transfer
String Name = "Chinese parameter ";
Response. Redirect ("B. aspx? Name = "+ Server. UrlEncode (Name ));
Receive
String Name = Request. QueryString ["Name"];
Response. Write (Server. UrlDecode (Name ));
3. Upload values to the asp.net page using javascript
Copy codeThe Code is as follows:
<Script language = "javascript">
Function escode ()
{
Location. href = "B. aspx? Name = "+ escape (Name );
}
</Script>
On the asp.net page, you can use Request. QueryString ("Name"). toString () to obtain the correct Chinese characters.