从一个区域的操作重定向到“根”区域中的操作?

时间:2010-01-13 18:55:02

标签: asp.net asp.net-mvc routing asp.net-mvc-routing

我使用最新版本的ASP.Net MVC 2 RC。

我的问题是,如何从“博客”区域中的一个操作重定向到我的应用程序“根”中存在的家庭控制器中的索引操作(无区域)?

我试过了:

return RedirectToAction("index", "home");

但重定向到 / Blog / home ,其中Blog是我的区域的名称。

2 个答案:

答案 0 :(得分:70)

试试这个:

return RedirectToAction("index", "home", new { area = "" });

答案 1 :(得分:4)

如果使用默认路由,这也应该有效,不确定ViewData会发生什么。

return Redirect("~/");