title: IIS AppPoolIdentity and file system write access permissions
body: <p>Here's an issue with IIS 7.5 and ASP.NET that I've been researching and getting nowhere with. Any help would be greatly appreciated.</p>
  
  <p>My question is: using ASP.NET in IIS 7.5, how does IIS and/or the operating system allow the web application to write to a folder like <code>C:\dump</code> when running under full trust? How is it that I don't have to explicitly add write access for the application pool user (in this case <code>ApplicationPoolIdentity</code>)?</p>
  
  <p>This much I know:</p>
  
  <ul>
  <li>In IIS 7.5, the default Identity for an Application Pool is <code>ApplicationPoolIdentity</code>.</li>
  <li><code>ApplicationPoolIdentity</code> represents a Windows user account called "IIS APPPOOL\AppPoolName", which is created when the Application Pool is created, where AppPoolName is the name of the Application Pool.</li>
  <li>The "IIS APPPOOL\AppPoolName" user is by default a member of the <code>IIS_IUSRS</code> group.</li>
  <li>If you are running under Full Trust, your web application can write to many areas of the file system (excluding folders like <code>C:\Users</code>, <code>C:\Windows</code>, etc). For example, your application will have access to write to some folders, like, <code>C:\dump</code>.</li>
  <li>By default, the <code>IIS_IUSRS</code> group is not given read or write access to <code>C:\dump</code> (at least not access that is visible through the "Security" tab in Windows Explorer).</li>
  <li>If you deny write access to <code>IIS_IUSRS</code>, you will get a SecurityException when trying to write to the folder (as expected).</li>
  </ul>
  
  <p>So, taking all of that into account, how is write access granted to the "IIS APPPOOL\AppPoolName" user? The w3wp.exe process runs as this user, so what allows this user to write to a folder it doesn't seem to have explicit access to?</p>
  
  <p>Please note that I understand this was probably done for the sake of convenience, since it would be a pain to grant a user access to every folder it needs to write to if you are running under Full Trust. If you want to limit this access, you can always run the application under Medium Trust. I am interested in finding out about the way the operating system and/or IIS allows these writes to take place, even though there appears to be no explicit file system access granted.</p>