1

I have a UNC link something like this on an ASP.NET page which links to an Network Share location. This link works perfectly in IE (surprisingly), and even in Chrome and Firefox if I copy/paste into the address bar, but the link is completely broken. I can't even right click to copy the link. I know this is a known issue, that was supposed to have been fixed several versions ago, but I still need a work around.

I've been looking into adding "content-disposition", "attachment; filename=sample.pdf" to the header, but I don't know how to reference the actual file because the link still doesn't work relative to the server. It keeps trying to save the aspx page rather than the pdf. Ideas? I would LOVE help on this. Thanks ;)

<a href="\\Server\AppShares\Files\sample.pdf" id="file">Download</a>

I'm actually implementing the link forming in the VB.NET codebehind, but I can't even get it to work properly with a statically defined link. What gives?

Chiramisu
  • 4,687
  • 7
  • 47
  • 77

1 Answers1

1

The Reason "\\Server\AppShares\Files\sample.pdf" is not excepted is that it is not a valid URI so not acceptable in a html link. The correct format is file://Server/AppShares/Files/samples.pdf http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx provides a guide on translations from UNC paths to URIs and back again

user1937198
  • 4,987
  • 4
  • 20
  • 31
  • Thank you. I actually found this out later, although I would mention that it is actually `file:///` (i.e. with three slashes) I believe. However, I ended up solving this by mapping a virtual directory to the UNC in IIS. I thought this a more elegant solution and it works with all browsers. Thanks! :) – Chiramisu Jan 08 '13 at 07:26
  • the number of slashes seems to vary by source and browser between 2 and 5 slashes – user1937198 Jan 09 '13 at 17:35
  • Indeed, and precisely why I went with the virtual directory instead. :) – Chiramisu Jan 09 '13 at 17:54