2010-05-17 37 views
2

我已經設置了一些區域,但我不確定如何通過RedirectToAction方法重定向到它們。似乎沒有任何區域參數我可以餵它。RedirectToAction的區域?

感謝

回答

4

您將需要使用RedirectToRoute如果你想重定向到當前區域外的一個ActionResult。你首先要確保你有一條到你想重定向到你的區域的ActionResult的路線。下面的文章是有所幫助:

http://msdn.microsoft.com/en-us/library/ee307987(VS.100).aspx#registering_routes_in_account_and_store_areas

一旦你有了到位的路線,你可以做return RedirectToRoute("MyRouteName");

+0

這似乎是工作得很好。謝謝! – chobo 2010-05-17 22:28:53

+0

很高興能幫到你! – 2010-05-17 22:31:33

5

這將工作太:

return RedirectToAction("ActionName","ControllerName", new { area = "AreaName" });