hyperlinks works with IE but not with Netscape

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

Hi,

i made dynamically hyperlinks for each file in directory "mydir":

fileEntries = Directory.GetFiles(Server.MapPath("~/mydir/"))
For Each fileName In fileEntries
Dim hl As New HyperLink
hl.NavigateUrl = fileName.Substring(Server.MapPath("~/").Length)
....
Next fileName


This works perfectly with IE7 but not with Netscape/Firefox.

With IE, when putting the mouse on the link, i read in the status bar: http://myserver/myapps/mydir/myfile.aspx
With Netscape, i read: http://myserver/myapps/mydir\myfile.aspx

When clicking on it with Netscape, i see in the addressbar of the browser: http://lmyserver/myapps/mydir\L0386\myfile.aspx
=> BAD REQUEST

Thanks for help
Eric
 
Bug in your code, "\" is not valid in a url. IE will automatically
switch "\" to "/", but other browsers won't and iis doesn't either. your
server code should do the replacement be setting the url.

-- bruce (sqlwork.com)
 
thanks

bruce barker said:
Bug in your code, "\" is not valid in a url. IE will automatically switch
"\" to "/", but other browsers won't and iis doesn't either. your server
code should do the replacement be setting the url.

-- bruce (sqlwork.com)
 
Back
Top