title: How do I access a NAS through my ASP.NET MVC Application?
body: <p>I'd like to access a Fileserver (NAS) through my ASP.NET MVC Application and can't find a way to do that in a correct way.</p>
  
  <p>What I've done so far is:</p>
  
  <ul>
  <li>Created a User with Read/Write permissions on a directory on my NAS</li>
  <li>Created a virtual directory on my IIS Server that is connected to the nas directory with the previously defined usercredentials</li>
  </ul>
  
  <p>Now if I navigate to my virtual directory (AppliCationIPAdress/NAS) I get automaticaly redirected to \NASIPAdress\My\Directory. On the NAS loginnotifications I get the info, that somewone connected to my directory with the given credentials => That is how it should be</p>
  
  <p>But if I access the NAS directory trough my MVC application (no matter if i use the UNC or the virtual directory redirection) i get an access denied erromessage and in the NAS loginnotifications there is not listed my prepared useraccount but my webserver as user who tried to login.</p>
  
  <pre><code>        var dirName = Server.MapPath("~/NAS/Dir/");
          ViewBag.Message = System.IO.Directory.GetFiles(dirName );
  </code></pre>
  
  <p>Could someone please explain why that is happening and what I have to do if i want to access files on a fileservice throuh my mvc application?</p>