向ASP.Net项目添加表单身份验证导致401.2未授权? [英] Adding Forms Authentication to ASP.Net project results in 401.2 Unauthorized?

查看:367
本文介绍了向ASP.Net项目添加表单身份验证导致401.2未授权?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试回顾性地将表单身份验证插入最初使用VS 2013和ASP.Net 4.0使用无身份验证模板创建的ASP.Net项目

I am trying to retrospectively plug in Forms Authentication to an ASP.Net project that was originally created with the no authentication template using VS 2013 and ASP.Net 4.0

我已经按照MSDN上的建议将其添加到我的Web Config下的system.web

I have followed the advice on MSDN and added this to my Web Config under system.web

 <authentication mode="Forms">
      <forms loginUrl="Logon.aspx" name=".ASPXFORMSAUTH">
      </forms>
    </authentication>
    <authorization>
      <deny users="?" />
    </authorization>

当我启动网站(IIS 7)时,URL重定向到Logon.aspx页面,但后来我得到错误消息401.2。:未经授权:由于服务器配置而导致登录失败。

When I launch the site (IIS 7) the URL redirects to the Logon.aspx page but then I get a Error message 401.2.: Unauthorized: Logon failed due to server configuration.

在IIS中,我设置了基于匿名和基于表单的网站验证已启用。

In IIS I have the website set for Anonymous and Forms based authentication enabled.

我在这里遗漏了什么吗?我认为在没有使用身份验证模板的情况下ASP.net可能会设置一个隐藏的设置?

Am I missing something here? I think there might be a hidden setting somewhere that ASP.net sets when he no authentication template is used?

编辑:问题是与此处报道的相同: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/2920a4e2-775a-4aa7-bfff-4931fa0a4e9a/azure-website-forms-authentication-issue? forum = windowsazurewebsitespreview

Edit: The issue is the same as reported here: https://social.msdn.microsoft.com/Forums/sqlserver/en-US/2920a4e2-775a-4aa7-bfff-4931fa0a4e9a/azure-website-forms-authentication-issue?forum=windowsazurewebsitespreview

看起来表单身份验证无法使用ASP.net模板项目存在问题。 :(。它适用于空ASP.Net网络应用程序,但其他任何一个都遇到了这个问题。

It looks like there is an issue with Forms authentication not working with ASP.net template projects. :(. It works fine with the "Empty ASP.Net web application" but any of the others runs into this issue.

推荐答案

经过多次挖掘,答案是删除ASP.net模板附带的Friendly URLS Nuget。

After much digging the answer is to remove the Friendly URLS Nuget that comes with the ASP.net templates.

这篇关于向ASP.Net项目添加表单身份验证导致401.2未授权?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆