Asp.net mvc 5表单身份验证错误
我想实施表格授权是我的申请 在我的控制器中,我设置:Asp.net mvc 5表单身份验证错误,asp.net,asp.net-mvc,forms-authentication,Asp.net,Asp.net Mvc,Forms Authentication,我想实施表格授权是我的申请 在我的控制器中,我设置: FormsAuthentication.SetAuthCookie(loginVm.use_email, loginVm.RememberMe); 那么在我看来, if (Request.IsAuthenticated) 我收到了我的请求。IsAuthenticated始终为false,因此我尝试在webconfig中添加以下行 <system.web> <authentication mode="Form
FormsAuthentication.SetAuthCookie(loginVm.use_email, loginVm.RememberMe);
那么在我看来,
if (Request.IsAuthenticated)
我收到了我的请求。IsAuthenticated始终为false,因此我尝试在webconfig中添加以下行
<system.web>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>
</system.web>
我正在调试模式下运行localhost,我应该怎么做才能使它按照您的要求工作
谢谢你的帮助
干杯我找到了答案,不知怎的,我在视图文件夹中找到了另一个web.config文件,所以我将其删除:),它现在可以正常工作了@UliKöhler:这不是问题的额外细节,而是一个“不知道为什么,但现在似乎可以正常工作”的解决方案。@deplicator Hm。。。有趣的观点。我现在已经回顾了这一点,尽管它看起来仍然有点奇怪,但我认为你是对的。我将删除我以前的评论。
It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.