在asp中加一个链接,指向asp.net网页,但asp.net的网址是经过HttpUtility.UrlEncode转换和HttpUtility.UrlDecode解码的,而asp的server.urlencode却和HttpUtility.UrlEncode的编码方式不一样,

举例:asp.net用Get方式传输的URL为:"WebPage.asp?str="+HttpUtility.UrlEncode(str)
,解码方式为HttpUtility.UrlDecode(Request.QueryString["str"].ToString().Trim())
asp的Get方式传送为"webPage.aspx?str="+server.urlencode(str) 两种编码不统一

解决方案:在asp使用Get方式传送"WebPage.aspx?str="+server.urlEncode( server.URLpathencode(str))
asp.net GET方式传送参数:"WebPage.aspx?str="+ HttpUtility.UrlEncode( str,System.Text.Encoding.GetEncoding("gb2312"))
asp.net GET方式接收参数:str= HttpUtility.UrlDecode(Request.QueryString["str"].ToString().Trim(),System.Text.Encoding.GetEncoding("gb2312"))

相关文章:

  • 2021-10-16
  • 2022-12-23
  • 2021-05-19
  • 2022-12-23
  • 2021-10-07
  • 2022-12-23
  • 2021-07-27
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-03
  • 2021-11-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-31
相关资源
相似解决方案