今天我开始玩MVC 3 Beta。从默认的MVC 3模板开始使用应用程序,在Home控制器中添加一个新的操作,如下(有一个视图)
[Authorize] public ActionResult Secured() { viewmodel.Message = "This is secured area,only authenticated users should be here."; return View(); }
现在当我试图去导航到安全的动作我得到一个404页面没有找到错误。
这是我的web.config中的身份验证部分。
<authentication mode="Forms"> <forms loginUrl="~/Account/logon" timeout="2880" /> </authentication>
如果我明白,授权属性应该会导致401未经授权的HTTP响应,应该由身份验证处理程序拦截并将其重定向到loginUrl。哪些应该导致帐户/ logon操作。
我的MVC 2应用程序按预期工作,并带我到Account / logon操作,我是否缺少一些东西?或者这是MVC 3 beta中的错误?
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。