Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do i create a password protection for my whole iis website, which uses php for most of its sites? I put a web.config in the root folder, but that seemed to do nothing. What i want is a way to protect my entire site so that the only way to see any web page is to login similar to using .htaccess for apache. Except i probably want it to be able to use windows login. Here was the web.config i used.

       <authentication mode="Windows" />
share|improve this question
up vote 1 down vote accepted

You have to install windows/basic authentication and then disable anonymous authentication in IIS administration console.

share|improve this answer
It took a little while to figure out what you meant, but i eventually got it to work. Thanks. – user57776 Oct 22 '10 at 0:31

I don't know how to do equivalence of htaccess using a htpasswd or alike, but you can create windows accounts and right click your webroot, then in security tab limit access to a specific user (or groups of users).

share|improve this answer
What i meant by the htaccess thing was just that i wanted it to popup asking for a password, instead of me having to use php to code it. And i was trying what you said, but i accidentally denied ComputerName\Users which apparently includes the Administrator as well. Oops. Gotta find a way to reset that. – user57776 Oct 21 '10 at 6:37
I fixed the permission accident, but it is still giving me a 500 error instead of asking for a user name and password. Is there a way i can get it to ask? I want it to be accessible to anywhere on the outside, but only people who are authenticated can view the site. – user57776 Oct 21 '10 at 6:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.