1. Set the Web.config file.
- <system.web>
- ......
- <globalization requestencoding= "gb2312" responseencoding= "gb2312" culture= "ZH-CN" fileencoding= "gb2312"/>
- ......
- </system.web>
Or:
aspx file:
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
2. Before passing the Chinese language, the Chinese parameters to be passed are encoded and decoded at the time of receiving.
>> to deliver
String Name = "Chinese parameters";
Response.Redirect ("B.aspx?") Name= "+server.urlencode (Name));
>> to receive
String Name = request.querystring["name"];
Response.Write (Server.urldecode (Name));
Or:
Navigateurl= ' <%# ' webform2.aspx? Singer= "+ httputility.urlencode (" Chinese ", System.Text.Encoding.GetEncoding (" GB2312 "))%> '
3. If it's from. HTML file to. Aspx file to pass the Chinese parameter (that is, do not use the Redirect () method for URL conversion from the background). To encode the passed Chinese parameters and decode them when they are received.
>> to deliver
<script language= "JavaScript" >
function Gourl ()
{
var Name = "Chinese parameter";
Location.href = "B.aspx?" Name= "+escape (Name);
}
</script>
<body onclick= "Gourl ()" >
>> to receive
String Name = request.querystring["name"];
Response.Write (Server.urldecode (Name));
Generally speaking. You can set the Web.config file. But if you use JavaScript to invoke the WebService method (pass the Chinese parameter to the WebService). Setting the Web.config file appears to be invalid.