0

I would like to know how to send plus symbol (+) over http link because when I try to send it after encoding like this %2B still I am getting empty space. If I try with + I am getting double empty space. Please help me on that.

I am sending like this to the page using the browser:

   localhost:/CPA-API/MT.aspx?msg=Testing%2BTesting

and receiving from the code behind like this:

   msg = Server.UrlDecode(Request.QueryString["msg"].ToString());

But I am getting output like this:

   msg = Testing Testing

Thanks in advance.

barsan
  • 2,431
  • 16
  • 45
  • 62

1 Answers1

1

try without urldecode

string msg = Request.QueryString["msg"];
string decoded = Server.UrlDecode(msg);

result:

msg = "Testing+Testing"
decoded = "Testing Testing"
Edi
  • 66
  • 4
  • also see msdn page for Request.QueryString: http://msdn.microsoft.com/en-us/library/ms524784(v=vs.90).aspx – Edi Sep 04 '14 at 10:08
  • When you use parameters with Request.QueryString, the server parses the parameters sent to the request and returns the specified data. If your application requires unparsed QueryString data, you can retrieve it by calling Request.QueryString without any parameters. - [MSDN](http://msdn.microsoft.com/en-us/library/ms524784(v=vs.90).aspx) – Edi Sep 04 '14 at 10:10
  • Thanks a lot for helping me out. But now I am trying to send the Euro sign € but I receive b$ with Request.QueryString["msg"] will you please mind to help me one more time? – barsan Sep 09 '14 at 06:33
  • sorry but for the url http://localhost:62348/Default.aspx?msg="asdf€" i receive msg="asdf€" and decoded="asdf€" – Edi Sep 30 '14 at 07:41
  • maybe thge problem is where you build your query string – Edi Sep 30 '14 at 07:43