Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access Denied error after setting up MVC application

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. Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET > Version:4.0.30319.18010

I followed the simple tutorial from here, ran the application and received this message.

like image 984
Nick Ky Avatar asked Jan 03 '13 09:01

Nick Ky


3 Answers

Check your project properties and ensure that Anonymous Authentication = Enabled. If you have <authentication mode="Windows" /> in your web.config, you will also need to set Windows Authentication = Enabled for the project (click the project in Solution Explorer):

Properties

The effect this has is to change the project file (.csproj) from saying:

<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />

To:

<IISExpressAnonymousAuthentication>enabled</IISExpressAnonymousAuthentication>
<IISExpressWindowsAuthentication>enabled</IISExpressWindowsAuthentication>

So you can also do this by hand, or fix it permanently by modifying the intranet project template.

like image 69
viperguynaz Avatar answered Oct 21 '22 17:10

viperguynaz


So I just wanted to chime in on something that worked for me. I created a new "ASP.Net MCV 4 Web application" and used the "Intranet Application" project template. I had to enable "Windows Authentication". I assume this is because I chose the intranet application template versus the internet application template.

like image 24
Cyrus Downey Avatar answered Oct 21 '22 17:10

Cyrus Downey


Basically first allow users or rolse access

Default web.config denies access

<authorization>
  <deny users="?" />
</authorization>

so make sure you allow yourself

<authorization>
  <allow users="domain\User" />
  <deny users="?" />
</authorization>
like image 30
Moji Avatar answered Oct 21 '22 17:10

Moji