日期:2014-05-17 浏览次数:20500 次
public class MvcApplication : System.Web.HttpApplication { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute("SiteIndex", "", new { controller = "Home", action = "Index", id = UrlParameter.Optional }); //装修公司首页) routes.MapRoute("ID", "{id}", new { controller = "Shop", action = "index", id = UrlParameter.Optional }, new { id = @"^[0-9]*$" }); //分站列表页 routes.MapRoute("Action", "{controller}", new { controller = "Home", action = "index", id = UrlParameter.Optional }); //装修公司列表页 routes.MapRoute("Shop3", "{id}/{action}-o{id3}-{id2}.html", new { controller = "Shop", action = "index", id = UrlParameter.Optional, id3 = UrlParameter.Optional }, new { id3 = @"^[0-9]*$", id2 = @"^[0-9]*$" }); //装修公司列表页 routes.MapRoute("Shop2", "{id}/{action}-o{id3}.html", new { controller = "Shop", action = "index", id = UrlParameter.Optional, id3 = UrlParameter.Optional }, new { id3 = @"^[0-9]*$", id2 = @"^[0-9]*$" }); //装修公司列表页 routes.MapRoute("Shop1", "{id}/{action}-{id2}.html", new { controller = "Shop", action = "index", id = UrlParameter.Optional, id2 = UrlParameter.Optional }, new { id = @"^[0-9]*$", id2 = @"^[0-9]*$" }); //装修公司列表页 routes.MapRoute("Shop", "{id}/{action}.html", new { controller = "Shop", action = "index", id = UrlParameter.Optional, id2 = UrlParameter.Optional }, new { id = @"^[0-9]*$" }); //分站详细页 routes.MapRoute("ContrHtml", "{controller}/{id}.html", new { controller = "Home", action = "detail", id = UrlParameter.Optional }, new { id = @"^[0-9]*$" }); routes.MapRoute("Control", "{controller}/{id}", new { controller = "Home", action = "detail", id = UrlParameter.Optional }, new { id = @"^[0-9]*$" }); //分站列表页 routes.MapRoute("NoAction", "{controller}/{id}", new { controller = "Home", action = "index", id = UrlParameter.Optional }); routes.MapRoute("Default", "{controller}/{action}/{id}", new { controller = "Home", action = "index", id = UrlParameter.Optional }); } protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RegisterRoutes(RouteTable.Routes); } }