title: Providing folder permission and accessing it from another server IIS
body: <p>I have two servers Server A and Server B. I have an application running in Server A. I'm trying to access contents from a folder in Server B and from the application running in Server A. </p>
  
  <p>The Server A application is running from IIS and I'm using the below piece of code in C# to read the folder contents. </p>
  
  <pre><code>public static string getFileInfo()
  {
      string retval = string.Empty;
      DirectoryInfo d = new DirectoryInfo(@"\\atom\bala");
      FileInfo[] Files = d.GetFiles("*.bak");
      string str = "";
      foreach (FileInfo file in Files)
      {
          str = str + ", " + file.Name;
      }
      return str;
  }
  </code></pre>
  
  <p>In the above code atom is my "Server B" and "bala" is the folder. I can clearly understand that my application from Server A is not having access to this folder. So i'm getting the below error message:</p>
  
  <pre><code>System.UnauthorizedAccessException: Access to the path '\\atom\bala' is denied.
  </code></pre>
  
  <p>I don't know how to get this access sorted. I have tried the following things:</p>
  
  <ul>
  <li>Provided access to NETWORK SERVICE.</li>
  <li>Anonymous Authentication is enabled in IIS. </li>
  </ul>
  
  <p>Apologies if my question is very basic as I'm a noob programmer. Can someone please help me sort this?</p>