Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Window authentication not working in MVC4

Scenario

User A can access all pages in MVC4 website except one. But user B can access all pages (no restriction).

What I had done so far?

  1. Deployed website on IIS 7.5.
  2. Enabled window authentication and disabled Anonymous authentication for hosted website on IIS.
  3. Testing website.

Testing Results -

(1) When User B is logged on same system (development system) where the website is deployed, he can access the website without prompt dialog.

(2) But when same website is published on server (production system) with same settings, website still asks for credentials with pop up.

** Both of the development system and production system are in same domain (let's name it domain.com).

Question

Why is the same user in same domain is been asked for credentials by website?

like image 921
Vikram Singh Saini Avatar asked Feb 25 '14 20:02

Vikram Singh Saini


1 Answers

As per my research for Window Authentication, I want to conclude following lines (also as reference for me) -

(1) Window Authentication (abbrev. WA) will always show prompt for verifying users if you had configured WA properly.

See anonymous authentication disabled and windows authentication enabled in below snapshot.

(2) Even if one set NTLM as top provider than Kerberos (in IIS), the IIS will still ask for Window credentials. Snapshot show how to do that.

How to set IIS Provider for Window Authentication

(3) If you want to avoid showing prompt on browser for WA, follow steps-

(a) Open IE browser --> Internet Options --> Security tab.

(b) Add site to Local Intranet zone so that browser will send logged-in username and password to IIS.

Add website to Intranet zone

Note - The above points universally apply to MVC and ASP.NET.

Answer to my question Why is the same user in same domain is been asked for credentials by website?

Because I had set anonymous authentication enabled along with Window authentication on development system. (Silly mistake).

like image 166
Vikram Singh Saini Avatar answered Oct 02 '22 16:10

Vikram Singh Saini