Handle # sign in url/querystring

  • Thread starter Thread starter David C
  • Start date Start date
D

David C

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)
 
"#"'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)
 
Back
Top