SitePoint Sponsor

User Tag List

Results 1 to 12 of 12

Thread: Making UNC paths work as links in IE8

  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2008
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Making UNC paths work as links in IE8

    On our intranet, I've been struggling to create clickable links for files from UNC paths that work in Internet Explorer 8. I can create an HTML page on my desktop or in a regular network folder and the links work fine. But they don't work if the HTML document resides on the IIS webserver. Could the server configuration be preventing these from working?

  2. #2
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    UNC paths aren't reliable in any browser across machines; the normal local networking path is not the type of communications browsers are even made to do in the first place.

    You say it's on a IIS webserver... is there some reason you're not using HTTP paths? Assuming the server names resolve right on the LAN, "http://your-server/example.html should work...

    For example I've got XAMPP running local on my Win7 workstation, and from any machine on the LAN I can go:
    http://psn-workstation/

    and get the root of XAMPP... I'd assume if IIS is running it would work the same way.

    Though on-page you should probably be using relative links instead of absolute links...

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2008
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm didn't use HTTP paths because the files in question aren't on the intranet webserver. Instead, they're in a shared folder that isn't on a webserver. This is a fairly large folder and I would rather not have to copy the files to the intranet server. My ASP script puts "file:///" at the start of each link, but from experimenting in plain HTML, IE8 will put that on automatically.

    On my HTML test page (just one link and nothing else), I tried HTTP and it gave me a File Not Found message. If I just have the UNC path, or if I use the FILE prefix, the link won't do anything when clicked.

  4. #4
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    my advice would be to NOT put any prefix before it and use relative paths... If your directory structure makes sense (down-tree) where your html are at 'root' and everything else cascades down from it, you shouldn't be needing long-form URL's in the first place...

    Though if it's ASP, doesn't that have to be on a server to even run in the first place?

  5. #5
    SitePoint Enthusiast
    Join Date
    Jul 2008
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The ASP is on the intranet server but the files themselves reside on a standard network server elsewhere in the network. That's why I'm using UNC paths.

  6. #6
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,424
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Just explictly declare the file protocol and it should work, eg: <a href="file://\\path\to\my\share\myfile.ext">

  7. #7
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Carstonio View Post
    The ASP is on the intranet server but the files themselves reside on a standard network server elsewhere in the network. That's why I'm using UNC paths.
    AHA, and there's your problem.

    Is the ASP being run from the server -- well, it would have to be, wouldn't it? so the asp is being fed via HTTP and the individual files are not?

    That' the cross site scripting block preventing it from working -- shouldn't work in any other browsers or IE7/newer. Shouldn't even work in 6 if you are patched up to date. You cannot access local files or LAN files from inside a http served page -- it's not allowed... because that's a massive security hole. Blocked on purpose! It's just not allowed in any modern browser... if it IS working in any browser, that browser's got a security hole!

    Which is a good question -- you said IE8, what do other browsers make of this?

  8. #8
    SitePoint Enthusiast
    Join Date
    Jul 2008
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What about setting up a virtual directory on the other server?

  9. #9
    SitePoint Addict
    Join Date
    Apr 2009
    Posts
    340
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    If you're using ASP most likely the IIS server is operating under a local user account that won't have permissions to the target computer with the files. Or you may not have file sharing enabled in the firewall on one or the other computer.

    From the webserver can you view the target files from explorer? Or in a command line window what does net view \\<targetserver> return? If all that looks normal under your user account, then I'll stick with my permissions guess above.
    Doug G
    =====
    "If you ain't the lead dog, the view is always the same - Anon

  10. #10
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,424
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by deathshadow60 View Post
    AHA, and there's your problem.
    That' the cross site scripting block preventing it from working -- shouldn't work in any other browsers or IE7/newer. Shouldn't even work in 6 if you are patched up to date. You cannot access local files or LAN files from inside a http served page -- it's not allowed... because that's a massive security hole. Blocked on purpose! It's just not allowed in any modern browser... if it IS working in any browser, that browser's got a security hole!
    Kinda sorta. If you get your intranet into the trusted zone then the old file:// links will work. Or at least they do here if we get the zones working the way we want.

  11. #11
    Non-Member bronze trophy
    Join Date
    Nov 2009
    Location
    Keene, NH
    Posts
    3,760
    Mentioned
    23 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wwb_99 View Post
    Kinda sorta. If you get your intranet into the trusted zone then the old file:// links will work. Or at least they do here if we get the zones working the way we want.
    I could see that, but I'd not expect it to work in anything but IE... since it should be the BROWSER blocking it, not the network settings...

  12. #12
    SitePoint Enthusiast
    Join Date
    Jul 2008
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by deathshadow60 View Post
    I could see that, but I'd not expect it to work in anything but IE... since it should be the BROWSER blocking it, not the network settings...
    Adding the intranet to Trusted Sites was ultimately the solution that we chose, since IE is the default browser on our network. Only a few of us in the tech area use additional browsers. Thanks to everyone for their assistance.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •