Request.QueryString

  • Thread starter Thread starter S. Han
  • Start date Start date
S

S. Han

When I type in "my.aspx?Detail=Factory+Entry" in IE browser, and retrieve
the query string with the following code:

string val = Request.QueryString["Detail"];

the returned val is not "Factory+Entry", but "Factory Entry" with a space.
Why does QueryString[] converts the '+' character to a space?
Is there a way to suppress the translation from a '+' to a space?
 
My first reply didn't appear over the weekend...

The + is another character for a space in UrlEncoding. If you would like to
have the + appear use the code %2b

my.aspx?Detail=Factory%2bEntry

It will come out correctly.

When you are building the querystring you should call Server.UrlEncode(
"Factory+Entry" ) and it will do the %2b for you.

HTH,

bill
 
Back
Top