4
votes

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

1
Do you have folder structure in your application like in Security folder you have Login page?Dnyanesh
Yes, my Login page is in Security folder but as long as I specify the path I don't see why it would be a problem. I get the same error when I create my Login.aspx page in my root directory too. Please check the top of my post I added something new to it.JTunney
I don't see any specific thing you are doing wrong. Visit this tutorial msdn.microsoft.com/en-us/library/vstudio/… for simple understading. Just wild guess instead of writing loginUrl="~/Security/Login.aspx" like this make it loginUrl="Security/Login.aspx"Dnyanesh
That didn't help. This is so strange.JTunney
stuck on this as well... figure it out?Roger

1 Answers

4
votes

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.