我使用最新版本的ASP.Net MVC 2 RC。
我的问题是,如何从“博客”区域中的一个操作重定向到我的应用程序“根”中存在的家庭控制器中的索引操作(无区域)?
我试过了:
return RedirectToAction("index", "home");
但重定向到 / Blog / home ,其中Blog是我的区域的名称。
答案 0 :(得分:70)
试试这个:
return RedirectToAction("index", "home", new { area = "" });
答案 1 :(得分:4)
如果使用默认路由,这也应该有效,不确定ViewData会发生什么。
return Redirect("~/");