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%20&%20Brady%20(Misc./No%20File%20#)
The value in the sname querystring is "Quarles & Brady (Misc./No File #)"
PopeDarren@gmail.com - 04 Apr 2008 20:37 GMT
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
David Wier - 04 Apr 2008 21:53 GMT
Check out this article concerning URLEncode:
http://www.codeproject.com/KB/aspnet/QueryString.aspx
David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup
>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.
[quoted text clipped - 6 lines]
>
> The value in the sname querystring is "Quarles & Brady (Misc./No File #)"
bruce barker - 04 Apr 2008 22:17 GMT
all querystring args are supposed to be urlencoded. see:
HttpUtility.UrlEncode
-- bruce (sqlwork.com)
> 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
[quoted text clipped - 6 lines]
>
> The value in the sname querystring is "Quarles & Brady (Misc./No File #)"
PopeDarren@gmail.com - 04 Apr 2008 22:41 GMT
David C - 05 Apr 2008 18:10 GMT
Thank you all. I knew there had to be a simple solution.
David
>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.
[quoted text clipped - 6 lines]
>
> The value in the sname querystring is "Quarles & Brady (Misc./No File #)"