Request.QueryString and Server.URLDecode()

J

John Grandy

Does Server.URLDecode() need to be applied to Request.QueryString(<key
name>) ?
 
L

Lucas Tam

Does Server.URLDecode() need to be applied to Request.QueryString(<key
name>) ?

Yes - if the string is encoded. Request.Querystring returns the raw
(undecoded) text.
 
S

Sean M

Yes, as I discovered this is also important when using Base64-encoded
strings in the QueryString. Here's what I use to combat frustration:

string sOKForBase64Decrypt =
Server.UrlDecode(Request.QueryString["argument"].ToString()).Replace("
","+")

-- Sean M
 
J

John Grandy

Hmmm ...

My tests don't show any need to apply Server.URLDecode() to
Request.QueryString()

I tested a return URL of

http://localhost/Results.aspx?search=here+are+some+spaces

Debug-mode stepping through the server-side code ,
Request.QueryString("search") contains the value "here are some spaces" (no
plus signs are included)







Sean M said:
Yes, as I discovered this is also important when using Base64-encoded
strings in the QueryString. Here's what I use to combat frustration:

string sOKForBase64Decrypt =
Server.UrlDecode(Request.QueryString["argument"].ToString()).Replace("
","+")

-- Sean M

John Grandy said:
Does Server.URLDecode() need to be applied to Request.QueryString(<key
name>) ?
 
J

Joerg Jooss

Lucas said:
Yes - if the string is encoded. Request.Querystring returns the raw
(undecoded) text.

Um... no. Items retrieved from the QueryString collection have already
been decoded (anything else would be disastrous).

Cheers,
 
L

Lucas Tam

Um... no. Items retrieved from the QueryString collection have already
been decoded (anything else would be disastrous).

Oops you're right : )

Always thought you needed to run it through Server.URLDecode.
 

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

Similar Threads

QueryString 4
Request.QueryString ??? 2
Server.UrlDecode from console application 4
Request.QueryString 2
Request.querystring 3
Request.QueryString execute 3
Request.QueryString 1
request.querystring 4

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top