JS加密对应的c#解码

 

escape不编码字符有69个:*,+,-,.,/,@,_,0-9,a-z,A-Z

encodeURI不编码字符有82个:!,#,$,&,',(,),*,+,,,-,.,/,:,;,=,?,@,_,~,0-9,a-z,A-Z

encodeURIComponent不编码字符有71个:!, ',(,),*,-,.,_,~,0-9,a-z,A-Z

1.

JS: escape : 解码使用:unescape

C#:HttpUtility.UrlEncode 解码使用: HttpUtility.UrlDecode

2.

JS: encodeURI :解码使用decodeURI();

C#: decodeURIComponent

3.

JS: encodeURIComponent  解码使用:decodeURIComponent()

C#:[HttpContext.Current.]Server.UrlDecode 解码使用: [HttpContext.Current.]Server.UrlEncode 

其实Escape,encodeURI,encodeURIComponent .其实都可以用HttpUtility.UrlDecode或者Server.UrlDecode 解码效果是一样的。

唯一区别看就是 HttpUtility.UrlDecode默认是utf8编码,Server.UrlDecode是根据webconfig配置的默认编码去解密的。

原文地址:https://www.cnblogs.com/Wilson6/p/9485968.html