[英]How to remove %20%20 from url in vb.net
我在url中遇到問題。%20%20正在url中添加。我嘗試了HttpUtility.UrlEncode方法。
但它仍顯示%20%20的網址。
這是我正在使用的代碼:
redirectUrl += "&return=" & Server.UrlEncode(ConfigurationManager.AppSettings("SuccessURL") & "?item_name=" + Server.UrlEncode(ItemDescription.ToString()) + "&amount=" + Server.UrlEncode(Amount.ToString()) + "&quantity=" + Server.UrlEncode(qty.ToString()))
這是瀏覽器中的返回網址:
http://localhost:53725/Project/SuccessPayment.aspx%20%20?item_name=%2b%27ULTRA%2bANTI-STATIC%2bWRIST%2bSTRAP%27&amount=9%2e99&quantity=1
如果我能夠在querystring variable(?)之前刪除%20%20。那么url對我有用。
請建議我如何解決這個問題。
%20
是空格字符。 因此,您需要將其修剪掉:
redirectUrl = Server.UrlDecode(redirectUrl).Trim() + "&return=" & Server.UrlEncode(ConfigurationManager.AppSettings("SuccessURL") & "?item_name=" + Server.UrlEncode(ItemDescription.ToString()) + "&amount=" + Server.UrlEncode(Amount.ToString()) + "&quantity=" + Server.UrlEncode(qty.ToString()))
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.