在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
效果如下图:Model-View-Controller全面分离.....
using System;
using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; namespace Sonven.Mvc { public class MvcApplication : System.Web.HttpApplication { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute("domain","", new { controller = "Web", action = "Index" }); //添加访问域名路由 } protected void Application_Start() { Sonven.Mvc.Router.MapRouterRules(RouteTable.Routes, 4); ViewEngines.Engines.Add(new Sonven.Mvc.ViewEngine()); RegisterRoutes(RouteTable.Routes); } } 不用再为controller/action/id添加路由,默认支持多级目录 |
请发表评论