Search code examples
vb.neturlgoogle-chromedownloadunc

UNC Linking to Network Share in Chrome


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?


Solution

  • 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