1. Set up the Web. config file .
<system.web> ... <globalization requestencoding= "gb2312" responseencoding= "gb2312" culture= "ZH-CN" fileencoding= "gb2312"/ > ... </system.web>
2. Before passing the Chinese, the Chinese parameter to be passed is encoded, and then decoded when it is received.
>> Pass string Name = "Chinese parameter";
Response.Redirect ("B.aspx? Name= "+server.urlencode (Name));
>> to receive the Span class= "Apple-converted-space" > string name = request.querystring["Name"];
Response.Write (Server.urldecode (Name));
3. If it is from. HTML file to. Aspx file to pass the Chinese parameter (that is, no Url translation from the background using the Redirect () method). It is necessary to encode the passed Chinese parameters and decode them when they are received.
JS in:
The escape () function encodes the string so that it can be read on all computers You can use Unescape () to decode an escape () encoded string.
>> delivery <script language= "JavaScript" > function Gourl () { var Name = "Chinese parameter"; Location.href = "B.aspx?" Name= "+escape (Name); }
< Span class= "Apple-converted-space" >< Span class= "Apple-converted-space" > </script>
< Span class= "Apple-converted-space" >< Span class= "Apple-converted-space" > <body onclick= "Gourl ()" >&NBSP;
< Span class= "Apple-converted-space" >< Span class= "Apple-converted-space" > > > Receive string name = request.querystring["name"];&NBSP;
Response.Write (Server.urldecode (Name));
Generally speaking. You can set the Web. config file. But if you call the WebService method with JavaScript (pass the Chinese parameter inside the WebService). Setting the Web. config file looks invalid.
Note: This article is reproduced in: http://blog.csdn.net/ypzgq/article/details/6254025
URL delivery in Chinese: Server.URLEncode and Server.urldecode