js中escape对应的C#解码函数 UrlDecode

mac2022-06-30  42

js中escape对应的C#解码函数 System.Web.HttpUtility.UrlDecode(s),使用过程中有以下几点需要注意   js中escape对应的C#解码函数 System.Web.HttpUtility.UrlDecode(s) //注意编码  需要注意的几点:  1、HttpUtility.UrlEncode,HttpUtility.UrlDecode是静态方法,而Server.UrlEncode,Server.UrlDecode是实例方法。  2、Server是HttpServerUtility类的实例,是System.Web.UI.Page的属性。  3、用HttpUtility.UrlEncode编码后的字符串和用Server.UrlEncode进行编码后的字符串对象不一样:  例如:  string url="http://search.99read.com/index.aspx?book_search=all&main_str=奥迷尔"; Response.Write(HttpUtility.UrlEncode(url)); Response.Write("<br>"); Response.Write(Server.UrlEncode(url));

输出结果是: http://search.99read.com/index.aspx?book_search=all&main_str=奥迷尔 http://search.99read.com/index.aspx?book_search=all&main_str=

转载请注明原文地址: https://mac.8miu.com/read-63595.html
最新回复(0)