Transfer:
String message = server. urlencode ("Welcome to ASP. NET! ");
Response. Redirect ("webform2.aspx? MSG = "+ message );
Resolution:
Server. urldecode (request. querystring ["MSG"])
If Javascript is used, escape () is used for encoding. server. urldecode () can also be used for decoding. Maybe they are encoded in the same way.
Use response. when the Redirect method transmits Chinese characters, it sometimes finds that the transmitted value is inconsistent with the received content. The received value may lose a few words or become a bunch of garbled characters. how can we ensure that the transmitted Chinese characters are correctly received?
The code for passing values on page a is as follows:
String message = server. urlencode ("Welcome to ASP. NET! ");
Response. Redirect ("webform2.asp? MSG = "+ message );
The code for page B's Acceptance value is as follows:
String message = server. urldecode (request. querystring ["MSG"]);
In some cases, the characters passed into garbled characters are caused by different encoding formats used by browsers and programs. asp. the default encoding format of the. NET application is "UTF-8 ". open the web. the following code is displayed in the config file:
<? XML version = "1.0" encoding = "UTF-8"?>
You can change the encoding format of an application by modifying the value of the encoding attribute. In some cases, you need to set this attribute to "gb2312" to understand Chinese garbled characters ".