Password Protect Directory Directly From IIS - VPS/Dedicated Servers

Password Protect Directory Directly From IIS - VPS/Dedicated Servers

In the event that you want to lock down a specific directory and you have administrator privileges on the server, this is one way you can go about it.
  1. Log into the server and open IIS Manager
  2. Drill down the navigation tree to the domain and/or directory you wish to password protect
  3. In the ASP.Net section, click on Authentication
  4. Set all to Disabled except for Basic Authentication, set that to Enabled
  5. In the ASP.Net section, click on Authorizatrion Rules
  6. Under the Actions pain, click Add Allow Rule...
  7. Under Specified Users, add the full windows username for the user you wish to have access
  8. Test by loading the directory in browser and using the user and credentials added in step 7

Notes on users:
  • You can add users either through an IIS integrated CMS (hsphere or plesk) or directly via Windows
  • Make sure the user has permissions for the domain root of the domain that you're wanting to secure

If you're still having issues connecting after setting it up this way, it's most likely a web.config issue. The following web.config is taken from a working protected directory and you should attempt to mirror it or identify discrepancies and investigate those:


<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <security>
            <authentication>
                <anonymousAuthentication enabled="false" />
                <basicAuthentication enabled="true" />
            </authentication>
            <authorization>
                <remove users="*" roles="" verbs="" />
                <add accessType="Allow" users="user1" />
                <add accessType="Allow" users="user2" />
            </authorization>
        </security>
    </system.webServer>
</configuration>


You can add as many users as you wish, just add a new user line per user.

If you're still having issues after this, please notify support via email or ticket submission.