12.8. Configuring Web Site Authentication

Problem

You want to authenticate users before they can access content on your web server.

Solution

Using a graphical user interface

  1. Open Internet Information Services (IIS) Manager.

  2. In the left pane, browse to the web site, directory, or file you want configure, right-click it, and select Properties.

  3. Select the Directory Security tab and click Edit under Authentication and access control.

  4. Select the authentication methods you want to enable on your web server and click OK.

  5. If the Inheritance Overrides dialog box appears, click Select All and click OK (repeat if this box appears again).

Using VBScript

' This code configurations authentication for a web site.
' ------ SCRIPT CONFIGURATION ------
strComputer = "<ServerName>"
strSiteID = "<SiteID>"
   
intFlag = 1 + 4
' Here are the available authentication values:
'     1 = Anonymous
'     2 = Basic
'     6 = MD5
'     4 = NTLM
'    64 = Passport
' For the intFlag variable, simply add together the
' numbers that represent the auth settings you want
' to configure.
' ------ END CONFIGURATION ---------
   
set objweb site = GetObject("IIS://" & strComputer & "/W3SVC/" & strSiteID)
objweb site.AuthFlags = intFlag
objweb site.SetInfo
WScript.Echo "Successfully modified auth settings for: " & _
             objweb site.ServerComment

Discussion

Authentication complements permissions as another tool for controlling access to content on IIS. When a user tries to access a web site, the user must first be authenticated. For a publicly hosted site designed ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.