Password Protect a single page

Discussion in 'Site Programming, Development and Design' started by Ray, Dec 16, 2010.

  1. Ray


    In IIS 7 you can either password protect a folder or password protect a specific page. When you password protect a folder all the files or objects within that folder will be password protected. However there maybe some instances where you do not want to password protect the entire content of that folder but merely a single page. To achieve this simply follow these steps.

    1. Connect to the web server using IIS 7 Manager.
    2. Click on “Content View “at the bottom of the IIS 7 Manager and navigate to the file you want to password protect.
    3. Right click on the target file and choose “Switch to Features View”.
    4. Double click on Authorization Rules.
    5. Click “Add Deny Rule”.
    6. In the pop up dialogue box, select “All anonymous users”.
    7. Click “OK”.​

    The web.config will now have this element inputted into it. Bear in mind that you do not have to go through IIS 7 Manager to achieve this. You can directly go to your applications web.config file and input the proper elements and properties to password protect a specific page.

    <location path="file1.aspx">
                        <add accessType="Deny" users="?" />
  2. How do you add users?

    I'd like to password protect a directory. I figured out how to add the deny anonymous users rule (which worked to block access), but I can't figure out how to add users. I tried creating an FTP user, but that didn't work. Where do I add users?

    Edited to add: I don't have an IIS Manage Users button. One help file I read said to click it and configure from there, but I don't see anything like that.
  3. Well, the FTP user that I added before now works. Not sure why. In case anyone reads this because they have the same question, you add web users via the FTP users section of the Winhost control panel. (I couldn't find a clear explanation of this in the help files.)
  4. Ray


    Last edited by a moderator: Oct 14, 2015

Share This Page