1

I am getting problem in url.%20%20 is adding in url.I have tried HttpUtility.UrlEncode Method.

But still it shows %20%20 in url.

Here is code that i am using:

redirectUrl += "&return=" & Server.UrlEncode(ConfigurationManager.AppSettings("SuccessURL") & "?item_name=" + Server.UrlEncode(ItemDescription.ToString()) + "&amount=" + Server.UrlEncode(Amount.ToString()) + "&quantity=" + Server.UrlEncode(qty.ToString()))

Here is return url in browser:

http://localhost:53725/Project/SuccessPayment.aspx%20%20?item_name=%2b%27ULTRA%2bANTI-STATIC%2bWRIST%2bSTRAP%27&amount=9%2e99&quantity=1

If i will able to remove %20%20 before querystring variable(?).Then url will work for me.

Please suggest me how i can solve this.

1 Answer 1

1

%20 is a space character. So you need to trim it away:

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()))
Sign up to request clarification or add additional context in comments.

2 Comments

Shouldn't the Trim be round the ConfigurationManager.AppSettings("SuccessURL") in your answer since in the question the %20%20 is before ?item_name?
Now you say it,,, yes it should.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.