title: FileUpload control in aspx.net not allowing file read
body: <p>I'm trying to read an uploaded file to the server using a FileUpload control, however, I'm gettting the following error:</p>
  
  <blockquote>
    <p>ASP.NET is not authorized to access the requested resource. Consider
    granting access rights to the resource to the ASP.NET request
    identity. ASP.NET has a base process identity (typically
    {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if
    the application is not impersonating. If the application is
    impersonating via <code>&lt;identity impersonate="true"/&gt;</code>, the identity will be
    the anonymous user (typically IUSR_MACHINENAME) or the authenticated
    request user</p>
  </blockquote>
  
  <p>I investigated and it seems that the folder do not have the permissions of the Network service account, so I add it but the problem is still there. Here is the code of my FileUpload control:</p>
  
  <pre><code>&lt;asp:FileUpload ID="FileUpload1" runat="server" style="top: 164px; left: 12px;       position: absolute; height: 22px; width: 281px" /&gt;
  </code></pre>
  
  <p>And here is the code that I'm using to save the file in my server:</p>
  
  <pre><code>protected void Button1_Click1(object sender, EventArgs e)
  {
      FileUpload1.SaveAs("C:\\folder\\autoTrack.xlsx");
      StatusLabel.Text = FileUpload1.PostedFile.FileName;
      if (FileUpload1.PostedFile.FileName != "")
      {
          this.readFile("C:\\folder\\autoTrack.xlsx"); //this is where the program crash due to lack of permissions!
      }
      else 
      {
          StatusLabel.Text = "Select a file to start the process!";
      }
  
  }
  </code></pre>
  
  <p>The ACL of the c:\folder folder have the network service with Full control permissions, and inheritance is enabled to propagate to child objects.</p>
  
  <p>Also I read that using a domain account in the Identity tab of the application pool can resolve the problem, but if I change the identity from the predefined Network service to my domain user, I got "Service unavailable" when trying to reach my application.</p>
  
  <p>Any help on this is really appreciated.</p>