Handle # sign in url/querystring

I have an asp.net page that sends a file name to another page for display.
However, when a file name has a # sign in it the full url is cut off at the
# sign. Below is an example of the url and the applicable code at the
receiving page. Can anyone help me as to handling this condition? Thanks.

David

url = "http://server/showdocs.aspx?doc=Test with #.doc"

Dim currurl As String = HttpContext.Current.Request.RawUrl.ToString
Dim strFile As String = ""

'Grab the full decoded url
strFile = HttpUtility.UrlDecode(currurl)
David C [ Mo, 07 April 2008 16:51 ] [ ID #1936975 ]

RE: Handle # sign in url/querystring

"#"'s are not allowed in url parameters as they denote a bookmark. it should
have been encoded when the url was produced. you need to get this fixed
(should be translated to %23)

-- bruce (sqlwork.com)


"David C" wrote:

> I have an asp.net page that sends a file name to another page for display.
> However, when a file name has a # sign in it the full url is cut off at the
> # sign. Below is an example of the url and the applicable code at the
> receiving page. Can anyone help me as to handling this condition? Thanks.
>
> David
>
> url = "http://server/showdocs.aspx?doc=Test with #.doc"
>
> Dim currurl As String = HttpContext.Current.Request.RawUrl.ToString
> Dim strFile As String = ""
>
> 'Grab the full decoded url
> strFile = HttpUtility.UrlDecode(currurl)
>
>
>
brucebarker [ Mo, 07 April 2008 17:28 ] [ ID #1936979 ]

Re: Handle # sign in url/querystring

You have to URL encode many special symbols. I see you are already decoding
the URL sent.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************************************************
| Think outside the box!
|
*************************************************
"David C" <dlchase [at] lifetimeinc.com> wrote in message
news:uwRHb8LmIHA.3400 [at] TK2MSFTNGP03.phx.gbl...
>I have an asp.net page that sends a file name to another page for display.
>However, when a file name has a # sign in it the full url is cut off at the
># sign. Below is an example of the url and the applicable code at the
>receiving page. Can anyone help me as to handling this condition? Thanks.
>
> David
>
> url = "http://server/showdocs.aspx?doc=Test with #.doc"
>
> Dim currurl As String = HttpContext.Current.Request.RawUrl.ToString
> Dim strFile As String = ""
>
> 'Grab the full decoded url
> strFile = HttpUtility.UrlDecode(currurl)
>
>
NoSpamMgbworld [ Mo, 07 April 2008 17:30 ] [ ID #1936980 ]
Microsoft » microsoft.public.dotnet.framework.aspnet » Handle # sign in url/querystring

Vorheriges Thema: Q: Get absolute path to a file.
Nächstes Thema: Error Code 80070545 when trying to run Web Service on another