C# JS URL 中文传参出现乱码的解决方法

在传参是先编码在传输,接受时先编码,在接收。

string mm=Server.URLEncode(你);

Response.Redirect(index.aspx?mm=+mm);

然后在接收页解码:

string mm = Server.URLDecode(Requext.querystring(mm));

js:

传参:用encodeURI("url参数")将url编码

收参:用decodeURI("接收到的值")解码

js传递参数,c# 接收参数 :

escape(s)

Server.URLDecode(Requext.querystring(s));

如果是url重写后的中文参数:

escape(escape(s))  这个是本人尝试了很多次之后得出来的

Server.URLDecode(Requext.querystring(s));

原文地址:https://www.cnblogs.com/hellen-li/p/3282792.html