ASP.NET MVC RedirectToAction跳转到其他Area
mvc使用Area分区开发后,存在在不同Area间跳转,需要为每个区间添加Area规则,如下:
public class CompanyAreaRegistration : AreaRegistration { public override string AreaName { get { return "Company"; } } public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "Company_default", "Company/{controller}/{action}/{id}", new { action = "Index", id = UrlParameter.Optional }, new string[] { "CompanySite.Areas.Company.Controllers" } ); } }
再使用如下语句就可以在不同Area间跳转:
return RedirectToAction("ChouseUserType", "Home", new { area = "User" });
最近评论