about escaped Query string

  • Thread starter Thread starter Anders Both
  • Start date Start date
A

Anders Both

If I receive a query string on the server that contains escaped char´s like
this:

text=%20asadfdsf%20%C6%D8%C5%20%E6%F8%E5%20AAA

How can I then get the NameValueCollection where the escaped value´s are not
exchanged (unescaped).

If i do like this Request.QueryString["text"] I dont get the content that
you see above, but the server try's to exchange the % stuff into something
else.

Best Regards
 
Off the top of my head, I would look at URLDecode in the HttpServerUtility
or HttpUtility class (have not tested, but this would flow well with
traditional ASP methods).

NOTE: There is also an HTML decode method in the HttpServerUtility to decode
characters like > (>), et al.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
Anders said:
If I receive a query string on the server that contains escaped char´s like
this:

text=%20asadfdsf%20%C6%D8%C5%20%E6%F8%E5%20AAA

How can I then get the NameValueCollection where the escaped value´s are not
exchanged (unescaped).

If i do like this Request.QueryString["text"] I dont get the content that
you see above, but the server try's to exchange the % stuff into something
else.

Best Regards

Request.Url.Query will get you the raw query string, but you'll have to
parse out all the parameters yourself - not too difficult a task.
 
thx, this is what i will do.

Best Regards

mikeb said:
Anders said:
If I receive a query string on the server that contains escaped char´s like
this:

text=%20asadfdsf%20%C6%D8%C5%20%E6%F8%E5%20AAA

How can I then get the NameValueCollection where the escaped value´s are not
exchanged (unescaped).

If i do like this Request.QueryString["text"] I dont get the content that
you see above, but the server try's to exchange the % stuff into something
else.

Best Regards

Request.Url.Query will get you the raw query string, but you'll have to
parse out all the parameters yourself - not too difficult a task.
 
Back
Top