ASP.NET MVC 5(Visual Studio的2013 preVIEW)更改登录网址[授权] [英] ASP.NET MVC 5 (Visual Studio 2013 Preview) Change Login Url for [Authorize]
问题描述
我开始玩弄了ASP.NET MVC 5 preVIEW,一切都已经进行了罚款至今(我只能推荐它)。
Hey guys I started playing around with the ASP.NET MVC 5 preview and everything has been going fine so far (I can only recommend it).
不过,我不知道我能为内置 [授权]
-Attribute设置登录的URL。我搬到了的AccountController
到一个地区,所以路径登录动作不再是 /帐号/登录
但 MyArea /帐号/登录
,这是由 [授权]
-Attribute,这反过来又意味着忽视,即每当出现一个导航控制器或动作的属性集,一个是重定向到错误的道路 /帐号/登录
。
However, I wonder where I can set the Login-Url for the Built-In [Authorize]
-Attribute. I've moved the AccountController
to a an area, so the path to the Login action is no longer /Account/Login
but MyArea/Account/Login
, which is ignored by the [Authorize]
-Attribute, which in turn means, that whenever one navigates to a controller or action with the attribute set, one is redirected to the wrong path /Account/Login
.
推荐答案
查看的web.config
像这样的内容:
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
更改 loginUrl
值,以指向更新后的登录页面。
Change the loginUrl
value to point to your updated login page.
这篇关于ASP.NET MVC 5(Visual Studio的2013 preVIEW)更改登录网址[授权]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!