Example:
AAA. aspx? Tag =. Net % BC % Ca % F5
AAA. aspx? Tag =. Net % E6 % 8A % 80% E6 % 9C % af
It seems to be different, in fact they are on the ". NET Technology" urlencode, but one is gb2312 encoding, one is the Utf-8 code.
The following code gets the effect after encoding:
Encryption Method:
String tmp1 = system. Web. httputility. urlencode (". NET technology", system. Text. encoding. getencoding ("gb2312 "));
String tmp2 = system. Web. httputility. urlencode (". NET technology", system. Text. encoding. utf8 );
Our actual web page may be called by other programs.
For example, an ASP page on a simplified Chinese operating system must pass a Chinese parameter to an Asp.net page.
By default, on the simplified Chinese operating system, ASP server. urlencode will encode Chinese in gb2312 encoding,
However, by default, the Asp.net page uses the UTF-8 encoding.
In this case, when you use request. querystring ["tag"] to accept the value, you will not be able to accept the Chinese information. What you can see in One-Step debugging is garbled characters.
At this time, although request. querystring ["tag"] is used to accept garbled characters, the URL at this time is not garbled.
The solution is to analyze the parameters in the URL, and then the parameter value according to gb2312 Encoding Anti-decryption, rather than using. Net default Utf-8 Encoding Anti-decryption.
URL decryption method:
If (request. querystring ["url"]! = NULL)
{
String url = server. urldecode (request. querystring ["url"]. tostring ());
This.txt address. Text = URL;
}