Tuesday, June 2, 2015

How to solve Access is denied problem for a ASP.NET MVC 4 Windows Authentication project



Create a ASP.NET MVC 4 intranet project, and run, get following error:

Access is denied
Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.
Error message 401.2.: Unauthorized: Logon failed due to server configuration.  Verify that you have permission to view this directory or page based on the credentials you
supplied and the authentication methods enabled on the Web server.  Contact the Web server's administrator for additional assistance.


Solution:
Press F4 to get project property windows:
Change Anonymous to Disabled
Change Windows Authentication to Enabled.


(Why just publish a correct project template for Windows Authentication in the first place?)