title: Delete file from server: Access to the path is denied
body: <p>I call this function from with my code-behind:<br>
  DeleteFile(Server.MapPath("/") + "sitemap_index.xml")</p>
  
  <pre><code>Public Shared Function DeleteFile(ByVal filename As String) As Boolean
  'deletes file from server
  Dim bResult As Boolean = False
  Try
      If File.Exists(filename) Then
          'delete file
          File.Delete(filename)
          bResult = True
      Else
          bResult = True
      End If
  Catch ex As Exception
  
  End Try
  Return bResult
  End Function
  </code></pre>
  
  <p>I then get the error: Access to the path 'E:\zz\wwwroot\sitemap_index.xml' is denied.</p>
  
  <p>In other sites of myself this logic works great, however on the current site it doesnt. I checked the security settings on my windows server 2008 R2 Standard.</p>
  
  <p>See here the settings I have on my Windows server on folder wwwroot:</p>
  
  <blockquote>
    <p>SYSTEM: Full Control<br>
    NETWORK SERVICE: Read + Write + Read &amp; Execute + List folder contents<br>
    IIS_IUSRS: Read + Write</p>
  </blockquote>
  
  <p>As was suggested by other posts I've been reading I tried adding other user groups, but I have no ASPNET service/group on my server.</p>
  
  <p>When logged in as administrator (Forms authentication) I can click a button to recreate the sitemap_index.xml and sitemaps.xml<br>
  Users should be able to delete and add images to the wwwroot\images\uploads folder</p>
  
  <p>Which group should I give what permissions to allow the above to be possible AND secure?</p>