Request.QueryString

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?
 
W

William F. Robertson, Jr.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top