IIS – Why can’t I log in to an ASP.NET website running on the server from the server using windows authentication

asp.netiiswindows-server-2012

Environment: Server 2012, IIS 8.0, ASP.Net MVC 5 application, SQL Server 2012

We have an ASP.Net MVC 5 application, that we have hosted on our server machine. The application uses Windows authentication (identity) for log in. After opening the website into the browser, we get a login window like this:Login

The issue we are facing is that the authentication works fine, if we try to access the site from other computers (http://www.johndoe.com/). However, when we try to access the site from the server using same url and any account (administrator or user), instead of authentication, this login window keeps popping up. If we hit 'cancel' we get an HTTP error 401.1 (unauthorized):

HTTP Error 401.1 – Unauthorized
You do not have permission to view this directory or page using the credentials that you supplied.

What are we doing wrong?

Best Answer

If I understood correctly, you're browsing to the website from the web server itself and Windows authentication is not working. If so, the first thing that comes to mind is the loopback check. Take a look at this article that talks about what is the loopback check and 2 workarounds to deal with the situation.