title: Link to Directory on Network
body: <p>So I'm working on an <em>Intranet</em> web application using <em>ASP.NET MVC</em>, and I need to create a link to a folder on the network. So, as an example, let's say I wanted to create a link to "C:\", and this uri is stored in <code>site.DocsPath</code>. I figured the easiest way to do this was just create a regular link, like this:</p>
  
  <pre><code>&lt;a href="file:///&lt;%= site.DocsPath %&gt;"&gt;Documents&lt;/a&gt;
  </code></pre>
  
  <p>This resolves to:</p>
  
  <pre><code>&lt;a href="file:///C:\ruby"&gt;Documents&lt;/a&gt;
  </code></pre>
  
  <p>However, when you click on the link, <strong><em>nothing happens</em></strong>. It's basically like clicking on regular text; absolutely <em>nothing</em> happens. No redirection, nothing. I tried this in both Firefox and IE, and this same behavior happens in both.</p>
  
  <p>Initially I thought it might be the slashes. So I pasted <code>file:///C:\ruby</code> into the address bar, to see if it was even right. It worked. I tried this in both Firefox and IE, and it works in both.</p>
  
  <p>So now, I'm thinking "hey, maybe my html isn't proper for some reason". So I created a small html page, as such:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;&lt;title&gt;Test Page&lt;/title&gt;&lt;/head&gt;
  &lt;body&gt;
      &lt;a href="file:///C:\ruby"&gt;Documents&lt;/a&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>And lo and behold..... it worked. I click on the link, and <em>it actually follows the link</em>. And this works in both Firefox and IE.</p>
  
  <p>So now I'm confused. The HTML is <strong>exactly the same in both cases</strong> (through <em>ASP.NET MVC</em> and in static HTML). And yet <strong>it only works in the static HTML case</strong>.
  <br /><br /><br /></p>
  
  <p>Now, I'm just pulling at straws. I try just pasting </p>
  
  <pre><code>&lt;a href="file:///C:\ruby"&gt;Documents&lt;/a&gt;
  </code></pre>
  
  <p>straight into the ViewPage in <em>ASP.NET MVC</em>. <em>Nope</em>, doesn't work.</p>
  
  <p>Then I try pasting just a random website statically into the ViewPage, like:</p>
  
  <pre><code>&lt;a href="http://www.google.com"&gt;Supreme Overlord of the Internet&lt;/a&gt;
  </code></pre>
  
  <p>And that <em>works</em>. So, now I have confirmed that ASP.NET actually can follow hand-generated links.</p>
  
  <p>Now, with just nothing left to do, I do something crazy. <strong>I set the link to somewhere that doesn't exist</strong>, like:</p>
  
  <pre><code>&lt;a href="file:///X:\this\doesnt\exist"&gt;I Hate ASP.NET MVC right now&lt;/a&gt;
  </code></pre>
  
  <p>Firefox sticks to its guns and doesn't follow it. <em>However</em>, <strong><em>IE actually follows it</em></strong> and gives me an error page. The same thing happens if <code>site.DocsPath = "X:\this\doesnt\exist"</code> and I put:</p>
  
  <pre><code>&lt;a href="file:///&lt;%= site.DocsPath %&gt;"&gt;Documents&lt;/a&gt;
  </code></pre>
  
  <p><br /><br /><br /></p>
  
  <p>So now, I'm totally confused. I don't know <em>what</em> the heck is going on. Clearly, ASP.NET MVC hates me, which is troubling because I have shown it nothing but love.</p>
  
  <p>If anyone has any idea what is going on, I would greatly appreciate the help. Thanks!
  <br /><br /><br /></p>
  
  <p><strong><em>UPDATE:</em></strong> After much testing (and many very helpful answers and comments from everyone here at SO), I've come to the conclusion that just creating a normal link to the folder just <strong><em>will not work</em></strong>. I eventually tried putting that static html page I created above on a webserver, and it turns out that it doesn't work. I also created a Ruby on Rails application and a small PHP application and tried it through those, and it doesn't work on them either. So the only other possibility is that it is in fact a browser thing.</p>
  
  <p>I think I will pursue maybe somehow connecting to the SharePoint server that all the documents are managed by. Thanks to everyone who commented and provided various answers on the question. I can only pick one answer, but everyone's comments and answers really provided a clear picture as to what was going on. Thanks!</p>