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)
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)
>
>
>
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)
>
>