Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I found the methods to escape the "%"(Percentage) and "_"(Underscore) like "[%]" and "[_]".
But how to do the same for character "+" ?

Is the same method applies to it ?

I am sending one parameter to a service and getting the result.
So, I can't do anything in SQL Server side.
I only need to format the parameter and send that to service so that I can get the correct result.

[EDIT]
One interesting thing I found is, when I enter "+" sign in the textbox, I am getting only a blank character in code behind while debugging. I am confused.
[/EDIT]

Thanks,
Tadit
Updated 12-Apr-13 5:02am
v2
Comments
ZurdoDev 12-Apr-13 12:10pm    
+ for a url is a space. However, what are you doing? You can use Server.UrlEncode or Server.HtmlEncode, depending on what you are doing.
Hi ryanb31,

Thanks for your reply.
No I am doing nothing with the URL. I am just taking the some value from TextBox, then passing that to a external WebService to get the result.

But, when I enter + sign in the TextBox, I get only a blank at the code behind, which is confusing....

I have added one answer today. :P

Thanks,
Tadit
Abinash_Sahoo 14-Apr-14 17:02pm    
how come + sign will be read as blank! do you have some kind of encoding already? is it an mvc application?
Sorry, for not updating the thread. I am adding one answer. :)

1 solution

Note : Sorry I forgot to update this thread. Just adding answer so that no one else get confused as I was that time.

The Problem was occurring because I have not Encoded the QueryString.

So, I encoded while sending from first page using HttpUtility.UrlEncode. Then I got the "+" sign in QueryString value perfectly without any other issues.
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900