地址栏参数UrlEncode编码和UrlDecode 解码

来源:互联网 发布:metatrader 4 mac版 编辑:程序博客网 时间:2024/06/05 06:46

//  编码

string url = ConfigurationManager.AppSettings["url"] +
                "?参数1=" + HttpUtility.UrlEncode(Convert.ToString(值1)) +
                "&参数2=" + HttpUtility.UrlEncode(Convert.ToString(值2)) +
                "&参数3=" + HttpUtility.UrlEncode(值3 +
                "&参数4=" + HttpUtility.UrlEncode(值4) +
                "&参数5=" + HttpUtility.UrlEncode(值5)
                + 参数6=" + HttpUtility.UrlEncode(值6);

// 解码

如果用到哪个参数 直接接收 然后 UrlDecode 就好了

 比如: string 参数1=HttpUtility.UrlEncode( request["参数1"].tostring());

   

 

 

 

原创粉丝点击