Url and querystring reading

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 #)"
 
P

PopeDarren

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
 
B

bruce barker

all querystring args are supposed to be urlencoded. see:

HttpUtility.UrlEncode


-- bruce (sqlwork.com)
 

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

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,814
Latest member
SpicetreeDigital

Latest Threads

Top