python ruby-programming-language Smalltalk Vue.js Knockoutjs TypeScript JavaScript, OOPs JavaScript Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 4 Angular 2 AngularJs 1.x NodeJs Perl Programming R Programming RequireJs Rust Programming Backbonejs closure programming language go-programming-language kotlin-programming-language

Windows Authentication in MVC4 with IIS Express

Hello everyone, I am going to share the about Windows Authentication in MVC4 with IIS Express or How to enable to Windows Authentication in MVC4  Web Application (projects) with IIS Express.

Just follow the few steps to windows authentication in MVC4 Web Application as given below.

Step 1 :

In the First step, you create MVC4 Web Application.

Step 2 :

Open MVC4 Web Application web config file for few modification for windows authentication.

i) Comment the code for form authentication section in system.web section.  i.e.

    <!--<authentication mode="Forms">
      <forms loginUrl="~/Account/Login" timeout="2880" />

j) Add the authentication mode is Windows.  i.e.

   <authentication mode="Windows"></authentication>

Step 3 :

Added to application Settings in the appSettings section. i.e.

    <add key="autoFormsAuthentication" value="false" />
    <add key="enableSimpleMembership" value="false"/>

Step 4:

Select  MVC4 Web Application project name in solution explorer and then click on the property explorer and select pick to Windows Authentication as Enabled and anonymous authentication as Enabled. i.e.

Step 5:

Add the Authorize attribute on top of  all controllers for Authorize to controllers. i.e.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace WindowAUth.Controllers
    public class HomeController : Controller
        public ActionResult Index()
            ViewBag.Message = "Modify this template to jump-start your ASP.NET MVC application.";
            return View();

        public ActionResult About()
            ViewBag.Message = "Your app description page.";

            return View();


In the last Step 5:

Now,  go to "Startup.cs" (at project's root) and comment the code inside "Configuration" method.

For the live video demo as given below.


Hi there! Welcome to my blog. My name is Anil Singh. I'm a author of this blog. For more detail about me, kindly refer to this link..
My Blogs - and
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like Powered by Blogger.
ASK Questions