UrlEncode和UrlDecode

//编码
HttpUtility.UrlEncode(str);
HttpUtility.UrlEncode(str, 编码类型);

//解码
HttpUtility.UrlDecode(str)

//编码
Server.UrlEncode(str);

//解码
Server.UrlDecode(str);


区别:
HttpUtility.UrlEncode()默认是以UTF8对URL进行编码,
而Server.UrlEncode()则以默认的编码对URL进行编码。
例子

 

posted @ 2015-09-10 11:11  飞行在午夜  阅读(110)  评论(0编辑  收藏  举报