Monday, November 11, 2013

Login prompt keeps coming when developing Intranet MVC4 Website on IIS Express

I created a MVC 4 project using Visual Studio 2012 on Windows 7 Computer that is a standalone and not a member of an Active Directory domain. I selected the intranet application template for the MVC4 application in Visual Studio 2012, successfully created initial aplication with no error and adjusted project property settings as the initial ReadMe.txt file showed (i.e., Anonymous Authentication = Disabled, Windows Authentication = Enabled).

However, when running the website using IIS Express, the Login Prompt keeps coming up. I thought this nuisance was due to the fact that my computer was not a member of any domain and therefore, the browser is not treating my request as intranet traffic. When I enter my local Windows user name and password, the IIS Express lets me in and I see my MVC4 website loaded in IE properly. Still, having to enter my credential each time I press Ctrl + F5 is a nuisance to take care of for my productivity.


Workaround: 
  1. Run IE. Go to [Tools] --> [Internet Options] menu. Select [Security] tab.
  2. Choose [Trusted Sites] and click the [Sites] button.
  3. Add "http://localhost" to your trusted website. Click [close] button.
  4. When back to the [Security] tab, make sure the [Trusted sites] is still selected. 
  5. Click [Custom level...] button while under the [Trusted sites] context. 
  6. Scroll down to "User Authentication". Select "Automatic logon with current user name and password"

Through another test, I confirmed that when you develop a intranet website using VS 2012 and IIS Express on a computer that is a member of an Active Directory domain, you do not run into this issue of unnecessary login prompt. This issue only happens when you develop on a stand-alone Windows machines.


No comments: