Windows Authentication in the Intranet Application Template in MVC

The Intranet Application template (available in ASP.NET MVC 3 Tools Update and later) is very similar to the Internet Application template, with one exception: It replaces Forms Authentication with Windows Authentication.
Because Registration and Log On with Windows Authentication are handled outside of the web application, this template doesn’t require the AccountController or the associated models and views. To configure Windows Authentication, this template includes the following line in web.config:

<authentication mode="Windows" />

This template also includes a readme.txt file with the following instructions on how to configure Windows Authentication in both IIS and IIS Express. In order to use the Intranet template, you’ll need to enable Windows authentication and disable Anonymous authentication.

IIS 7 and IIS 8

  1. Open IIS Manager and navigate to your website.
  2. In Features View, double-click Authentication.
  3. On the Authentication page, select Windows authentication. If Windows authentication is not an option, you’ll need to make sure Windows authentication is installed on the server.
    To enable Windows authentication in Windows: 

    1. In the Control Panel, open Programs and Features.
    2. Select Turn Windows features on or off.
    3. Navigate to Internet Information Services -> World Wide Web Services -> Security and make sure the Windows authentication node is checked.

    To enable Windows authentication on Windows Server:

    1. In the Server Manager, select Web Server (IIS) and click Add Role Services.
    2. Navigate to Web Server -> Security and make sure the Windows authentication node is checked.
  4. In the Actions pane, click Enable to use Windows authentication.
  5. On the Authentication page, select Anonymous authentication.
  6. In the Actions pane, click Disable to disable anonymous authentication.

IIS Express

  1. Click on your project in the Solution Explorer to select the project.
  2. If the Properties pane is not open, open it (F4).
  3. In the Properties pane for your project:
    1. Set Anonymous Authentication to Disabled.
    2. Set Windows Authentication to Enabled.
Tagged . Bookmark the permalink.

Leave a Reply