Url and querystring reading

  • Thread starter Thread starter David C
  • Start date Start date
D

David C

I have an asp.net page that sends a querystring to a new web page (see full
url below). The querystring takes a filename as one of the parameters. The
problem I am having is when the filename contains a "&" then when I read the
querystring it doesn't read past the embedded "&". Any way around this?
Thanks.
David

http://server/Fileroom/frmSubfolder.aspx?fn=90216&seq=9&sname=Quarles & Brady (Misc./No File #)

The value in the sname querystring is "Quarles & Brady (Misc./No File #)"
 
I haven't had to do this since I wrote classic asp... When I had this
problem back then I wrote my own little encoder and decoder, which is
really simple if you think you'll only have a problem with that one
little bitty character. Something like:

myStr = myStr.replace("&", "$A$M$P")

Then on the next page:

myStr = Request("fileName").ToString.Replace("$A$M$P", "&")

Or you could use the encrypter and decrypter. I haven't used that,
but it looks like there is some good info here:

http://www.devcity.net/Articles/47/1/encrypt_querystring.aspx
http://forums.asp.net/t/989552.aspx
 
all querystring args are supposed to be urlencoded. see:

HttpUtility.UrlEncode


-- bruce (sqlwork.com)
 
Back
Top