首页 新闻 会员 周边

asp.net mvc2 为什么 RedirectToAction() 跳转没有反应?

0
悬赏园豆:10 [已解决问题] 解决于 2012-05-29 10:53

  public ActionResult Logout()
        {
            ContextService.Close();
            FormsAuthentication.SignOut();

            return RedirectToAction("Index", "Home");
        }

主要是实现退出登录,然后跳转,但是就是跳转不到那个页面,也没有报错。不知道为什么,求助

问题补充:

AccountController控制器有

public ActionResult Login()
{
  return View();
}

public ActionResult Logout()
{
ContextService.Close();
FormsAuthentication.SignOut();
return RedirectToAction("Index", "Home");
}

通过模板页点击“退出”,跳转到Logout,但是RedirectToAction()并没有起到作用,在这方法执行完了以后又走了一遍Login(),相当于跳转到了Login()。我看了继承的父类也没有相关的实现,Global也都看过了,都不是这些问题。

chengkuan的主页 chengkuan | 初学一级 | 园豆:90
提问于:2012-05-28 17:03
< >
分享
最佳答案
1
            return Redirect("/Home/Index");
收获园豆:6
Sanco | 菜鸟二级 |园豆:236 | 2012-05-28 18:11
其他回答(1)
1
return RedirectToAction( "Index", new RouteValueDictionary( 
    new { controller = "Index", action = "Home" } ) );
收获园豆:4
dudu | 园豆:31003 (高人七级) | 2012-05-28 17:42

提示找不到/Index.

return Redirect("/Home/Index"); 这个事可以的,但是就是不知道为什么。
RedirectToAction()这个方法为什么就不行了、???
支持(0) 反对(0) chengkuan | 园豆:90 (初学一级) | 2012-05-29 09:07

@chengkuan: RedirectToAction()是到同一个Controller的其他Action。

支持(0) 反对(1) dudu | 园豆:31003 (高人七级) | 2012-05-29 10:14

@dudu: 非常感谢

支持(0) 反对(0) chengkuan | 园豆:90 (初学一级) | 2012-05-29 10:52
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册