1. Set the web.config file. (I don't like setting it))
......
......
or:
ASPX file:
2. Before passing the Chinese, the Chinese parameter to be passed is encoded, and decoded again when receiving. >> Transfer
String name = "Chinese parameters";
Response.Redirect ("B.ASPX? Name =" Server.urlencode (Name));
>> 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 is to pass the Chinese parameter from the .html file (ie, the URL conversion is not made from the back office). The passing Chinese parameter is to be encoded, and decoded again when receiving.
>> Transfer
Function gourl ()
{
VAR name = "Chinese parameters";
Location.href = "B.ASPX? Name =" escape (name);
}
script>
>> 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 call the WebService method (transfer Chinese parameters to WebService). Set the web.config file seems to be invalid.
--------------------
Realize codes in HTML:
Function OpenURL (SRC)
{
Var strurl = escape (src);
WINDOW.OPEN (STRURL);
}
Function Change_URL (SRC)
{
Document.location.href = escape (src);
}
script>
Save in the new window
'JavaScript: OpenURL ("CSS / 200403123628 trading center to facilitate trading system contract.doc");'> 20040603123628 Trading Center online centralized trading system contract
Note: The slash in the path is: "/", not "/", otherwise it will not work.
----------------------------------------
When I met when I was developed in .NET web development (I am a .NET newbie, so there is more problematic), is the value of querystring if the Chinese characters are passed as the parameter value, if the Chinese characters are passed as the parameter value Maybe it may be wrong. Simply put, such as this URL: urlparmtest.aspx? PARM1 = China & Parm2 = Chinese In Request.QueryString, PARM1 and PARM2 are all "China", which obviously has problems, but in some cases are normal. of.
If the request is not directly passed through the URL, use Response.Redirect operations in server-side operations, has not encountered a similar problem.
At that time, I think Chinese is a double-byte code. It may be uncertainty when it passes, or use English.
But why is it in Server REDIRECT is normal, where is the problem?
Yesterday I asked in GTEC's classmates, probably understood: If you set Chinese parameters in the .cs file, use Server.urlencode ("Chinese) to Chinese Parameters Encode if it is set in the .aspx file. Please use <% = server.urlencode ("Chinese)%> When eNCode is querystring, you can get normal Chinese string without decode.
Here is some explanations given by classmates: urlencode converts some multi-byte characters into the single-byte character allowed in the URL, the browser will do it automatically, but there are still some problems, so you can eNCode, The acceptance will automatically decode the URL. I think response.Redirect may make sure that Encode work, so there is no problem.