MVC窗体LoginUrl是不正确 [英] MVC Forms LoginUrl is incorrect

查看:215
本文介绍了MVC窗体LoginUrl是不正确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个窗体身份验证的ASP.NET MVC 3应用程序。出于某种原因,我不能看到,登录重定向URL是 /帐号/登录?RETURNURL =%2fSecure%2fAction 而不是 /帐号/ LogOn支持? RETURNURL =%2fSecure%2fAction 。所不同的是微妙的,它的使用/帐号/ 登录而非/帐号/ LogOn支持

我的web.config形式部分是正确的。否则将可能会影响到登录URL ??

 <身份验证模式=表格>
  <形式loginUrl =〜/帐号/登录超时=720/>
< /认证>


解决方案

这是一个已知的问题。我有同样的问题,我的自定义授权属性。我找到了解决办法某处净,不记得在哪里。就在这添加到的appSettings 你的的web.config

 <添加键=loginUrlVALUE =〜/帐号/登录/>

注:的这适用于MVC 3,我没有previous版本试试吧。

编辑:
发现它在发行说明提及,但似乎他们已经改变了设置命名并忘记更新发行说明RTM版本。

I have an ASP.NET MVC 3 application with forms authentication. For some reason that I cannot see, the login redirect url is /Account/Login?ReturnUrl=%2fSecure%2fAction instead of /Account/LogOn?ReturnUrl=%2fSecure%2fAction. The difference is subtle, its using /Account/Login instead of /Account/LogOn.

My web.config forms section is correct. Would else could possibly affect the login url??

<authentication mode="Forms">
  <forms loginUrl="~/Account/LogOn" timeout="720" />
</authentication>

解决方案

This is a known issue. I had the same problem with my custom authorize attribute. I found the solution somewhere on the net, can't remember where. Just add this to appSettings in your web.config

<add key="loginUrl" value="~/Account/LogOn" />

Note: This works with MVC 3, I didn't try it with previous versions.

EDIT: Found it mentioned in release notes, but it seems that they've changed the setting name and forgot to update release notes for RTM version.

这篇关于MVC窗体LoginUrl是不正确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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