I have a webapp created using C# and asp.net. I placed a parameter value in the querystring with a plus(+) sign. But the plus sign disappear.
How can I include the plus sign(+) in the query string without disappearing?
Here I found the same question and according to it, I have used Server.UrlEncode(myqerystring)
and the time of decoding Server.UrlDecode(myqerystring)
but some how it always resolves to the SPACE
here is watch window
1) Querystring after the Server.UrlEncode()
2) Querystring after the Server.UrlDecode()
notice the space between S
and R
it should be +
. I am new to all web development and I read other answers which says use UrlEncode and decode
but it giving the same issue as before am I doing something wrong and yes the query string is automatically generated. I have no control over it.
There is other hack replace the " " or "%2b" with "+" I will go to that if I dont find any good way. So is there any good way to do this. Thanks.
The answer you link to just mentions using Server.UrlEncode, not Server.UrlDecode. When you read from Request.Querystring it automatically decodes the string for you. Doing it manually a second time is corrupting it and is why you're getting a space.