ASP.NET 现在要URL伪静态,但是传递的参数是中文的时候就提示找不到页面。

Response.Redirect("askquestion_" + HttpUtility.UrlEncode(str, System.Text.Encoding.GetEncoding("GB2312")) + ".html");

web.config
<rewrite url="~/askquestion_(\d+)\.html" to="~/askquestion.aspx?str=$1" />

第1个回答  2011-06-01
可以将传递的参数先进行url编码,然后在传递
第2个回答  2011-06-01
中文要进行编码才可以,否则是乱码!
第3个回答  2013-08-11
下面的都傻x吧这种编码后的参数%u4E1D%u889C 那个iis7.0以上的自带的url重写控件不认

直接报404的节奏 应该想个办法写个正则
第4个回答  2011-06-02
Server.UrlDecode Server.UrlEncode 用这个俩个函数 转码解码
相似回答