"This is due to security restrictions in the browser. If you generate a file:// link, it is relative to the
user's file system. Theoretically, if browsers allowed these types of links, attackers could discover information about a user's file system remotely. Thus, modern browsers do not allow this type of link. Unfortunately this is not very well documented,
and most browsers allow the links and just drop the behaviour - so nothing happens when you click them. There aren't any good workarounds either."
Anja G
0 Points
8 Posts
Re: Open local file via href
Apr 19, 2012 01:04 PM|LINK
Also the
is resolved as "http://localhost/WebApplication2/@C:/TMP/worksheet.xlsx" and can't be accessed in any way.
Who'd ever told me that opening a file from browser can be such a disaster :(
Thanks for trying to help me.
bbcompent1
All-Star
32974 Points
8500 Posts
Moderator
Re: Open local file via href
Apr 19, 2012 01:08 PM|LINK
Let me see if I can cook up a code behind solution to do this. I know I've done this before but I'm hard pressed to remember how I did it.
Anja G
0 Points
8 Posts
Re: Open local file via href
Apr 19, 2012 01:14 PM|LINK
Using | result in same 'non-clickable' URLs
bbcompent1
All-Star
32974 Points
8500 Posts
Moderator
Re: Open local file via href
Apr 19, 2012 01:15 PM|LINK
I hate to be the voice of gloom and doom but it is just not possible:
http://stackoverflow.com/questions/2313806/asp-net-hyperlink-not-working
"This is due to security restrictions in the browser. If you generate a file:// link, it is relative to the user's file system. Theoretically, if browsers allowed these types of links, attackers could discover information about a user's file system remotely. Thus, modern browsers do not allow this type of link. Unfortunately this is not very well documented, and most browsers allow the links and just drop the behaviour - so nothing happens when you click them. There aren't any good workarounds either."
Anja G
0 Points
8 Posts
Re: Open local file via href
Apr 19, 2012 01:19 PM|LINK
Hmmm, that's really strange as a simple HTML that looks like
will do the thing...
bbcompent1
All-Star
32974 Points
8500 Posts
Moderator
Re: Open local file via href
Apr 19, 2012 01:21 PM|LINK
Its unfortunate but it is a restriction that is imposed by modern web browsers.