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

巧了我就是萌 提交于 2019-12-12 12:25:09

问题


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:


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.



来源:https://stackoverflow.com/questions/25903140/net-forms-authentication-using-iis8-0-express-vs2013-401-2-unauthorized

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!