• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

asp页面和Asp.net页面传中文参数UrlEncode编码以及接收解码

asp 搞代码 4年前 (2022-01-03) 49次浏览 已收录 0个评论

在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( 来源gao@!dai!ma.com搞$$代^@码网str,System.Text.Encoding.GetEncoding(“gb2312”))
asp.net GET方式接收参数:str= HttpUtility.UrlDecode(Request.QueryString[“str”].ToString().Trim(),System.Text.Encoding.GetEncoding(“gb2312”))

以上就是asp页面和Asp.net页面传中文参数UrlEncode编码以及接收解码的详细内容,更多请关注gaodaima搞代码网其它相关文章!


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:asp页面和Asp.net页面传中文参数UrlEncode编码以及接收解码
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址