[Solved] .NET Forms Authentication using IIS8.0 Express (vs2013) – 401.2.: Unauthorized: Logon failed due to server configuration

One thing to note: I created a Webapp w/ Individual User Accounts Authentication and added
and it works exactly as expected. I wonder what is different between this app and when starting with No authentication.

I created a fresh webforms app w/ no Authentication just to make sure there was nothing specific in my project. Follow this tutorial to setup basic forms authentication. When I load my project I get the below error rather then it redirecting me to my Login.aspx page. My overall goal is to create a webapp that basically doesn’t allow users to access any page unless they are signed in. Since I specify the Login page in the forms tag I am assuming it makes that an accessible page to anonymous users so everyone can login. I feel like my problem has to do with IIS8.0 Express or my project settings. ‘Windows Authentication=disabled’ ‘Anonymous Authentication=enabled’.

<system.web>
  <authentication mode="Forms">
    <forms loginUrl="~/Security/Login.aspx" name=".ASPXFORMSAUTH" timeout="60">
    </forms>
  </authentication>
  <authorization>
    <deny users="?" />
  </authorization>
</system.web>

Below is the error I am getting:

Server Error in ‘/’ 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.34212

Enquirer: JTunney

||

Solution #1:

Had the same issue and found this in my web.config:

<system.webServer>
<modules>
<remove name="FormsAuthentication" />
</modules>
</system.webServer>

Not really sure how it got there but removing it fixed my problem.

I figured I would post it just in case it will help others.

Respondent: JTunney

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Leave a Reply

Your email address will not be published.