标签:
mvc使用Area分区开发后,存在不同Area之间的跳转,需要为每个区间添加Area规则,如下:
using System.Web.Mvc; namespace web.Areas.FrameSet { public class FrameSetAreaRegistration : AreaRegistration { public override string AreaName { get { return "FrameSet"; } } public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "FrameSet_default", "FrameSet/{controller}/{action}/{id}", new { controller = "Frame", action = "Main", id = UrlParameter.Optional }, new string[] { "web.Areas.FrameSet.Controllers" } ); } } }
再使用如下语句就可以在不同Area间跳转:
return RedirectToAction("Main", "Frame", new { area = "FrameSet" });
再传2个参数:
return RedirectToAction("Main", "Frame", new { area = "FrameSet", a = 2, b = "b" });
?a=2&b=b
标签:
原文地址:http://www.cnblogs.com/soundcode/p/5800628.html