title: Password-protect folder with web.config
body: <p>I have to password protect a directory on a Windows server. The page is supposed to show a list of files located in that directory. I don't have any previous knowledge (only worked with Apache before) so I've tried hacking something together by googling. (For someone who knows what they're doing I'm sure this will look ridiculous)</p>
  
  <p>What I have right now is I get a login-popup but no password is working. We have a table in our SQL database for adminusers so either fetching user-login from there or having the login embedded in the config file is fine. All I need is the folder to be password-protected.</p>
  
  <p>This is what I have right now in my web.config file that is located in the folder that is supposed to be password-protected.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;configuration&gt;
      &lt;system.web&gt;
          &lt;authentication mode="Forms"&gt;
              &lt;credentials passwordFormat="Clear"&gt;
                  &lt;user name="test" password="test" /&gt;
              &lt;/credentials&gt;
          &lt;/authentication&gt;
          &lt;authorization&gt;
              &lt;allow users="test" /&gt;
              &lt;deny users="*" /&gt;
          &lt;/authorization&gt;
      &lt;/system.web&gt;
      &lt;system.webServer&gt;
          &lt;directoryBrowse enabled="true" /&gt;
          &lt;security&gt;
              &lt;authentication&gt;
                  &lt;anonymousAuthentication enabled="false" /&gt;
                  &lt;basicAuthentication enabled="true" /&gt;
                  &lt;windowsAuthentication enabled="false" /&gt;
              &lt;/authentication&gt;
          &lt;/security&gt;
      &lt;/system.webServer&gt;
  &lt;/configuration&gt;
  </code></pre>
  
  <p>Hopefully this is a simple problem and thanks in advance for any help! :)</p>