【问题标题】:encodeURIComponent issue in QuerystringQuerystring 中的 encodeURIComponent 问题
【发布时间】:2014-03-04 05:18:59
【问题描述】:

我使用 encodeURIComponent 并在查询字符串中发送它,但是当我在 asp.net 页面中得到它时,它发生了变化。这是代码。

var postType = encodeURIComponent($(obj).parents(".post").attr("data-item-type"));
var postId = encodeURIComponent($(obj).parents(".post").attr("data-item"));
window.location.href = "PostDetail.aspx?" + GetGUID() + '&pId=' + postId + '&pType=' + postType;

在asp页面中

在网址中显示正确的“rEpJZ8IDRfIbFpptDl%2B84w%3D%3D&pType=ereq47B7tt0BQMO5nRRbOQ%3D%3D”

但在 asp 页面中它是 "rEpJZ8IDRfIbFpptDl 84w==" 在 HttpUtility.UrlDecode(Request.QueryString("pId")) 之后

【问题讨论】:

  • 原始值是多少不是rEpJZ8IDRfIbFpptDl 84w==?

标签: asp.net query-string urlencode


【解决方案1】:

这是正确的。 其他值在

 HttpUtility.UrlDecode(Request.QueryString("pType"))

【讨论】:

  • 解决办法是什么?
  • 使用encodeURIComponent之前的值是多少
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多