Url and querystring reading

Url and querystring reading

am 04.04.2008 21:17:55 von 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&snam e=Quarles%20&%20Brady%20(Misc./No%20File%20#)

The value in the sname querystring is "Quarles & Brady (Misc./No File #)"

Re: Url and querystring reading

am 04.04.2008 21:37:05 von 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.asp x
http://forums.asp.net/t/989552.aspx

Re: Url and querystring reading

am 04.04.2008 22:53:50 von David Wier

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


"David C" wrote in message
news:eaZVbjolIHA.1184@TK2MSFTNGP04.phx.gbl...
>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&snam e=Quarles%20&%20Brady%20(Misc./No%20File%20#)
>
> The value in the sname querystring is "Quarles & Brady (Misc./No File #)"
>
>

RE: Url and querystring reading

am 04.04.2008 23:17:01 von brucebarker

all querystring args are supposed to be urlencoded. see:

HttpUtility.UrlEncode


-- bruce (sqlwork.com)


"David C" wrote:

> 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&snam e=Quarles%20&%20Brady%20(Misc./No%20File%20#)
>
> The value in the sname querystring is "Quarles & Brady (Misc./No File #)"
>
>
>

Re: Url and querystring reading

am 04.04.2008 23:41:50 von PopeDarren

Sweet. Thanks Bruce!

Re: Url and querystring reading

am 05.04.2008 19:10:04 von David C

Thank you all. I knew there had to be a simple solution.
David
"David C" wrote in message
news:eaZVbjolIHA.1184@TK2MSFTNGP04.phx.gbl...
>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&snam e=Quarles%20&%20Brady%20(Misc./No%20File%20#)
>
> The value in the sname querystring is "Quarles & Brady (Misc./No File #)"
>
>