1. Solve the problem through web. config
<System. Web>
<Globalization requestencoding = '"gb2312" response/encoding = 'gb2312 "Culture =" ZH-CN "fileencoding =" gb2312 "/>
</System. Web>
2. Set the ASPX page to know the Request Encoding of the same page as the ASPNET in the head.
<Head runat = "server">
<Title> </title>
<Meta http-equiv = "content_type" content = "text/html; charset = gb2312">
</Head>
3. encode the Chinese parameters to be passed and decode the parameters when receiving them.
Encoding method 1. httputility. urlencode
Is the frontend method:
<Asp: hyperlink id = "hyper" runat = "server"
Navigateurl = '<% # "B. aspx? Name "+ httpuility. urlencode (" Chinese ", system. Text. encoding. getencoding (" gb2312 ") %>'
Pass to B
</ASP: hyperlink>
Encoding method 2; server. urlencode
Is the background method:
String name = "Chinese ";
Response. Redirect ("B. aspx? Name = "+ server. urlencode (name ));
Encoding method 3: javascript encoding Transmission
Function gourl ()
{
VaR name = "Chinese ";
Location. href = "B. aspx? Name = "+ escape (name );
}
Accept the passed Value
If (request ["name"]! = NULL)
{
String name = request ["parm1"];
Response. Write (server. urlencode (name ));
}
In general, you can set web. config. If you use JavaScript to call WebService, the Web. config setting will be invalid.
4. Enable the machine to support Chinese Characters
1. If the preceding method is not correct, open the page in notepad and select utf_8 as the encoding method instead of the default ANSI
2. Open the registry and ensure that the value of hkey_local_machinne/system/CurrentControlSet/services/intinfo/parameters/favordbcs is 0.
3. After modifying the value, you must run iisreset to restart the IIS service.