这可能是这些简单的问题之一..我试图重定向用户后,他们已经成功验证,或返回到登录页面。但成功页面是在不同的路线,我不能得到重定向工作..ASP.Net MVC - 重定向到路由给重定向循环
这里是我的航线Globals.asax:
routes.MapRoute(_
"Default", _
"{controller}/{action}/{id}", _
New With {.controller = "Login", .action = "Index", .id = ""} _
)
routes.MapRoute(_
"Stuff", _
"{controller}/{action}/{id}", _
New With {.controller = "Stuff", .action = "Index", .id = ""} _
)
我有2个控制器:LoginController.vb
和StuffController.vb
。该Views/Login/Index.aspx
文件包含一个简单的形式与代码:
<form method="post" action="/Login/Authenticate">
的LoginController
包含以下代码:
Function Authenticate() As RedirectToRouteResult
' authentication code commented out ;o)
Return RedirectToRoute("Stuff")
End Function
而且StuffController包含以下内容:
Function Index()
' show stuff..
Return View() ' return /Views/Stuff/Index.aspx
End Function
这里是我的”已经尝试到目前为止:
- 功能进行身份验证()
- 功能进行身份验证()作为的ActionResult()
- 功能进行身份验证()作为RedirectToRouteResult()
所有这些导致浏览器重定向循环超时。我错过了什么?!
伟大的问题,我遇到了同样的问题! – MrBoJangles 2011-12-19 17:08:49