本文介绍了RedirectToAction的领域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了一些地区,但我不知道如何通过RedirectToAction方法重定向到他们。目前似乎没有任何区域的参数,我可以养活它。

I have setup some areas, but I'm not sure how to Redirect to them via the RedirectToAction method. There doesn't seem to be any Area parameter I can feed it.

感谢

推荐答案

您将需要使用的如果您正试图重定向到当前区域外的一个ActionResult。您首先要确保你有给的ActionResult路线要重定向到您所在地区注册。下面这篇文章是有帮助的是:

You will need to use RedirectToRoute if you are trying to redirect to an ActionResult outside the current area. You will first want to make sure you have a route to the ActionResult you would like to redirect to registered for your area. The following article is helpful for this:

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

一旦你在的地方的路线,你可以做返回RedirectToRoute(MyRouteName);

Once you have routes in place, you can do return RedirectToRoute("MyRouteName");

这篇关于RedirectToAction的领域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 00:43