需要使用的类:System.Web.HttpUtility
在这个类中可以使用UrlEncode()和UrlDecode()方法进行编码和解码!
例
解码:
string s = "%5B1%2C2%5D";
string result = System.Web.HttpUtility.UrlDecode(s);
此时result的值为"[1,2]"
编码:
string s = "[1,2]";
string result = System.Web.HttpUtility.UrlEncode(s);
此时result的值为"%5B%31%2C%32%5D"
本文详细介绍了如何使用System.Web.HttpUtility类中的UrlEncode()和UrlDecode()方法进行URL编码和解码操作,通过示例展示了编码与解码的过程,帮助开发者更好地理解和应用这些功能。
3181

被折叠的 条评论
为什么被折叠?



