asp.net url after delivery of the address bar garbled (more than two Chinese characters) _ Practical skills

Source: Internet
Author: User

Encoding good URL is correct, can be uploaded to another page will be wrong, in the address bar has been garbled
1. Set up Web.config file

Copy Code code as follows:

<system.web>
<globalization requestencoding= "gb2312" responseencoding= "gb2312" culture= "ZH-CN" fileencoding= "gb2312"/>
</system.web>

2.asp.net to asp.net page values
For delivery
String Name = "Chinese parameters";
Response.Redirect ("B.aspx?") Name= "+server.urlencode (Name));
To receive
String Name = request.querystring["name"];
Response.Write (Server.urldecode (Name));
3.javascript transfer value to asp.net page
Copy Code code as follows:

<script language= "JavaScript" >
function Escode ()
{
Location.href = "B.aspx?" Name= "+escape (Name);
}
</script>

Normal use of Request.QueryString ("Name") in the ASP.net page. toString () to get the correct Chinese

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.