2013-05-17 50 views
0

我正在使用下面的代碼通過javascript來分配iframe src。它工作正常。但在後面的C#代碼我得到了這樣的查詢字符串。 id=Y&amp%3bcust_id=100&amp%3。我如何減少此。現在使用c獲取Querystring值#

var value = "validity.aspx?id=Y&cust_id=" + cust_id + ""; 
frameElement.src = value 

我想從查詢字符串中獲取客戶的價值,但它總是返回null。

if(Request.QueryString["cust_id"] !=null) //It returns null 
+0

發生在VAR值線路斷點,看看什麼cust_id是否有它 – tariq

+0

它返回null.But它擁有確切的客戶id。由於這個原因它返回null。 – user2176150

+0

Server.UrlDecode(xxxxxxxx) –

回答

0

您需要編碼您的 「&」 caracters。出於某種原因,服務器正在將它們讀取爲& amp%3b。

試試這個:

var value = "validity.aspx?id=Y&cust_id=" + cust_id + ""; 
value = encodeURIComponent(value); 
frameElement.src = value 
0

你需要使用HttpUtility.HtmlDecode

嘗試像這樣的URL進行解碼:

var value = HttpUtility.HtmlDecode(URL); 
+0

嘿兄弟,你刪除你的問題? sql-substract-row-wise-value-from-previous-row-value-cumulative ...無法再找到頁面 – cyan