在C#中如何URL编码和解码

解码:

string s = "MSIClientContract_MSI20028-%E5%B9%BF%E5%B7%9E%E9%85%B7%E7%8B%97%E8%AE%A1%E7%AE%97%E6%9C%BA%E7%A7%91%E6%8A%80%E6%9C%89%E9%99%90%E5%85%AC%E5%8F%B8202102021019558386_001";

string result = System.Web.HttpUtility.UrlDecode(s);

此时result的值为"MSIClientContract_MSI20028-广州酷狗计算机科技有限公司202102021019558386_001"

编码:

string s = "MSIClientContract_MSI20028-广州酷狗计算机科技有限公司202102021019558386_001";

string result = System.Web.HttpUtility.UrlEncode(s);

原文地址:https://www.cnblogs.com/michelledawm/p/14783722.html