title: IIS7 - How to password protect a single folder using a Web.config file?
body: <p>I have a folder that contains log files.  They're not super critical, but I don't want total strangers looking through them.  I'd like to put a password on that one folder.  The folder and its contents are served straight up from IIS, so I'm not looking for a coding solution.</p>
  
  <p>With Apache I'd use a <code>.htaccess</code> file.</p>
  
  <p>With IIS it's possible to use multiple <code>Web.config</code> files at various levels to control this kind of thing.</p>
  
  <p>So, what goes in the <code>Web.config</code> file that allows me to require a password when accessing this folder?</p>
  
  <ul>
  <li>I'm happy for the password to pop up in a dialog like old-school websites used to do (not sure what this is called -- I think it is digest authentication) and so avoid any <code>loginUrl</code> redirection stuff</li>
  <li>I'm happy to put the password in the <code>Web.config</code> file in plain text if it's easier</li>
  </ul>
  
  <p>The application is internet facing and running on shared hosting, so I don't have much control over the box beyond what I can configure in <code>Web.config</code>.</p>