C# 使用c获取查询字符串值#
我正在使用下面的代码通过javascript分配iframe src。它工作正常。但在c#code behind中,我得到了如下查询字符串<代码>id=Y&%3bcust\U id=100&%3。我怎样才能减少这个,现在C# 使用c获取查询字符串值#,c#,javascript,asp.net,c#-4.0,query-string,C#,Javascript,Asp.net,C# 4.0,Query String,我正在使用下面的代码通过javascript分配iframe src。它工作正常。但在c#code behind中,我得到了如下查询字符串id=Y&%3bcust\U id=100&%3。我怎样才能减少这个,现在 var value = "validity.aspx?id=Y&cust_id=" + cust_id + ""; frameElement.src = value 我想从查询字符串中获取customer的值,但它总是返回null if(Request.Query
var value = "validity.aspx?id=Y&cust_id=" + cust_id + "";
frameElement.src = value
我想从查询字符串中获取customer的值,但它总是返回null
if(Request.QueryString["cust_id"] !=null) //It returns null
您需要对“&”字符进行编码。由于某些原因,服务器正在将它们读取为&%3b
试试这个:
var value = "validity.aspx?id=Y&cust_id=" + cust_id + "";
value = encodeURIComponent(value);
frameElement.src = value
您需要使用HttpUtility.HtmlDecode解码URL 试着这样做:
var value = HttpUtility.HtmlDecode(URL);
在var值行放置一个断点,查看itit中的cust_id有什么返回null。但它保留准确的客户id。由于这个原因,它返回null.Server.UrlDecode(xxxxxxxx)嘿,兄弟,你删除你的问题了吗?sql从上一行值中减去行值累计。。。再也找不到该页了