访问路径 “xxxx.aspx?act=acc+bac&id=45 ”实现结果,获取act的值,现在通过下面的方法获取的值,就变成了accbac ,丢失了‘+’号,请问怎么处理,加号必须要有,必须接收的值,是acc+bac;HttpContext.Current.Server.HtmlEncode(HttpContext.Current.Request.Form[key.ToString()]).Replace(
                            "'", "''"));
请问怎么做才能获取完整的值啊。

解决方案 »

  1.   

    string s = Request.QueryString["act"].ToString();
      

  2.   

    传入的值需要Encode,然后再Decode
      

  3.   

    Server.UrlEncode()
    Server.UrlDecode()
      

  4.   

    xxxx.aspx?act='acc+bac'&id=45 试试看 获取之后 在把''去掉
      

  5.   

    发送前应该编码,接收后解码。如果不是数字和英文就必须这一步。 HttpUtility.UrlEncode  编码
                HttpUtility.UrlDecode 解码
      

  6.   


    正解。 添加引用 System.Web;
      

  7.   

    在页面中<a></a> 里面的链接用
    Server.UrlEncode()
    Server.UrlDecode()
    但如果js 触发事件链接其他网页就自动过滤特殊字符
    就算用  Request.RawUrl 获取完整路径都照样过滤
    只能在外面算好再放进去
      

  8.   

    最后的解决方法:
       string txtvalue = HttpContext.Current.Server.UrlDecode(HttpContext.Current.Server.UrlEncode(HttpContext.Current.Request.Form["values"]).Replace("+", "%2B").Replace(" ", "+").Replace("\"", "%22").Replace("&", "%26"));