zoukankan      html  css  js  c++  java
  • ASP.NET MVC5路由实践RouteConfig

    RouteConfig.cs

    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
         //如请求http://localhost:50836/test,由ZJ.MVC5.Platform.Controllers.TestController.cs 响应请求 
            routes.MapRoute(
                name: "Default2",
                url: "test/{action}",
                defaults: new { controller = "Test", action = "Index", id = UrlParameter.Optional },
                namespaces: new string[] { "ZJ.MVC5.Platform.Controllers" }
            );
    
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
            ////defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            //defaults: new { controller = "Default", action = "Index", id = UrlParameter.Optional },
            ////defaults: new { controller = "Test", action = "ShopPic", id = UrlParameter.Optional },
            //namespaces: new string[] { "ZJ.MVC5.Platform.Areas.Movie" } //影片管理
            //).DataTokens.Add("Area", "Movie");
    
            defaults: new { controller = "Default", action = "Index", id = UrlParameter.Optional },
            namespaces: new string[] { "ZJ.MVC5.Platform.Areas.QuestionBank" }
            ).DataTokens.Add("Area", "QuestionBank");
        }
    }
  • 相关阅读:
    远离热闹
    漫步泰晤士小镇
    逛2011上海宠物大会(多图)
    iphone 4入手一周使用心得与感受
    章鱼帝
    南非世界杯赛程表下载(Excel版)
    相亲记
    再评富士康悲剧
    上海的朋友出门注意
    有感于车船税
  • 原文地址:https://www.cnblogs.com/zhuji/p/13540859.html
Copyright © 2011-2022 走看看