1.设置web.config文件。
<system.web>
......
<globalization requestEncoding="gb2312" responseEncoding="gb2312" culture="zh-CN" fileEncoding="gb2312" />
......
</system.web>
<wbr></wbr>
2.传递中文之前,将要传递的中文参数进行编码,在接收时再进行解码。
>> 进行传递
string Name = "中文参数";
Response.Redirect("B.aspx?Name="+Server.UrlEncode或HttpUtility.UrlEncodeUnicode (Name));
<wbr></wbr>
>> 进行接收
string Name = Request.QueryString["Name"];
Response.Write(Server.UrlDecode(Name));
<wbr></wbr>
<wbr></wbr>
3.如果是从 .HTML 文件向 .Aspx 文件进行传递中文参数的话(即不从后台用 Redirect()方法进行 Url 转换)。一样要将传递的中文参数进行编码,在接收时再进行解码。
>> 进行传递
<script language="JavaScript">
function GoUrl()
{
<wbr><wbr><wbr> var Name = "中文参数";<br><wbr><wbr><wbr> location.href = "B.aspx?Name="+<strong>escape</strong>(Name);<br> }<br> </script><br> <body onclick="GoUrl()"></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr></wbr>
>> 进行接收
string Name = Request.QueryString["Name"];
Response.Write(Server.UrlDecode(Name));
一般来说。设置web.config文件就可以了。但是如果你用 JavaScript 调用 webservice 方法的话(往webservice里面传递中文参数)。设置 web.config 文件好象无效。
<wbr></wbr>
4、html文件向aspx页面传递中文参数
<wbr><wbr><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr><wbr><wbr><wbr><strong><span style="color:#ed1c24">>> 进行传递</span></strong><br><wbr><wbr><wbr><wbr> <script language="JavaScript"><br><wbr><wbr><wbr><wbr> function GoUrl()<br><wbr><wbr><wbr><wbr> {<br><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> var Name = "中文参数";<br><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> location.href</wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> =OnlineSend.aspx?Name =" + encodeURI(Name)+ "&sid="<wbr> + Math.random().toString();<br><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> //在请求某个页面并传递参数时,请在后面再加个传递参数(值为随机数) ,以保存下次请求时IE<br><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> //浏览器认为不是请求的同一个页面,否则IE浏览器认为是请求的统一页面,会从缓存中打开该页<br><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> //面,导致参数不能正确传递过去<wbr><wbr><wbr> sid=" + Math.random().toString();<br><wbr><wbr><wbr><wbr> }<br><wbr><wbr><wbr><wbr> </script><br><wbr><wbr><wbr> <body onclick="GoUrl()"><br><wbr><wbr><wbr><wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
<wbr><wbr><wbr><strong><span style="color:#ed1c24">>> 进行接收</span></strong><br><wbr><wbr><wbr> string Name =Request.QueryString["Name "].ToString();</wbr></wbr></wbr></wbr></wbr></wbr>
<wbr></wbr>
<wbr></wbr>
<wbr><wbr><wbr> 原帖地址:<a href="http://greatverve.cnblogs.com/archive/2011/06/25/url-character.html">http://greatverve.cnblogs.com/archive/2011/06/25/url-character.</a><a href="http://greatverve.cnblogs.com/archive/2011/06/25/url-character.html">html</a></wbr></wbr></wbr>