当前位置: 首页>>代码示例>>C#>>正文


C# AreaRegistrationContext.MapRoute方法代码示例

本文整理汇总了C#中System.Web.Mvc.AreaRegistrationContext.MapRoute方法的典型用法代码示例。如果您正苦于以下问题:C# AreaRegistrationContext.MapRoute方法的具体用法?C# AreaRegistrationContext.MapRoute怎么用?C# AreaRegistrationContext.MapRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.Mvc.AreaRegistrationContext的用法示例。


在下文中一共展示了AreaRegistrationContext.MapRoute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "Directory",
                "Cheetah/{controller}/{action}/{*location}",
                new { Controller = "Document", action = "Index", Location = UrlParameter.Optional },
                new[] { "Vnsf.WebHost.Areas.Cheetah.Controllers" }
            );

            context.MapRoute(
                "Application",
                "Cheetah/{controller}/{applicationId}/{action}",
                new { Controller = "Application" },
                new[] { "Vnsf.WebHost.Areas.Cheetah.Controllers" }
            );

            context.MapRoute(
                "profile",
                "Cheetah/UserProfile/Education/{action}",
                new { controller = "UserProfile", action = "NewEducation", id = UrlParameter.Optional },
                new[] { "Vnsf.WebHost.Areas.Cheetah.Controllers" }
            );

            context.MapRoute(
                "Cheetah_default",
                "Cheetah/{controller}/{action}/{id}",
                new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                new[] { "Vnsf.WebHost.Areas.Cheetah.Controllers" }
            );
        }
开发者ID:hanoitown,项目名称:vnsf,代码行数:30,代码来源:CheetahAreaRegistration.cs

示例2: RegisterArea

 public override void RegisterArea(AreaRegistrationContext context)
 {
     //index
     context.MapRoute(
         "AdminArea_Index",
         "adminarea/index.html",
         new
         {
             action = "index",
             controller = "home"
         },
         new[] { "Icode.Blog.Web.Areas.AdminArea.Controllers" }
     );
     //默认路由
     context.MapRoute(
         "AdminArea_default",
         "adminarea/{controller}_{action}.html",
         new
         {
             action = "index",
             controller = "home"
         },
         new[] { "Icode.Blog.Web.Areas.AdminArea.Controllers" }
     );
 }
开发者ID:haoxilu,项目名称:IcodeBlog,代码行数:25,代码来源:AdminAreaAreaRegistration.cs

示例3: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
            #region == Blog ==
            context.MapRoute(
                "Accounts_Blog_default",
                "Accounts/Blog/{action}",
                new { action = "Index", controller = "Blog" }
            );
            #endregion


            #region == Company ==
            context.MapRoute(
                "Accounts_Company_default",
                "Accounts/Company/{action}",
                new { action = "NewsList", controller = "Company" }
            );
            #endregion



            context.MapRoute(
                "Accounts_default",
                "Accounts/{action}",
                new { action = "Index",controller="Accounts" }
            );
        }
开发者ID:lvjialiang,项目名称:PlantEng,代码行数:27,代码来源:AccountsAreaRegistration.cs

示例4: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
            var routeContraint = new UserRouteConstraint(DependencyResolver.Current.GetService<IUserRepository>());

            context.MapRoute(
            "Users_albums",
            "{username}/albums/{id}/{name}",
            new { controller = "albums", action = "name", id="id"},
            constraints: new
            {
                username = routeContraint,
            });

            context.MapRoute(
            "Users_date",
            "{username}/{year}/{month}/{day}",
            new { controller = "date", action = "Index", month = UrlParameter.Optional, day = UrlParameter.Optional },
            constraints: new
                {
                    username = routeContraint,
                    year = @"\d{4}"
                });

            context.MapRoute(
            "Users_media",
            "{username}/media/{id}",
            new { controller = "Media", action = "Index" },
            constraints: new { username = routeContraint });

            context.MapRoute(
                "Users_default",
                "{username}/{controller}/{action}/{id}",
                new {  controller = "index", action = "Index", id = UrlParameter.Optional },
                constraints: new { username = routeContraint });
        }
开发者ID:chuckconway,项目名称:momntz-legacy,代码行数:35,代码来源:UsersAreaRegistration.cs

示例5: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                name: "Forums_default",
                url: "Forums",
                defaults: new
                {
                    controller = "Home",
                    action = "Index"
                },
                namespaces: new[] { "Zanshin.Areas.Forums.Controllers" });

            context.MapRoute(name: "Topic_Default",
                url: "Forums/{forumId}",
                defaults: new
                {
                    controller = "Home",
                    action = "Topics",
                    forumId = UrlParameter.Optional
                }, namespaces: new[] { "Zanshin.Areas.Forums.Controllers" });

            context.MapRoute(name: "Posts_default",
                url: "Forums/Posts/{topicId}",
                defaults: new
                {
                    controller = "Home",
                    action = "Posts",
                    topicId = UrlParameter.Optional
                }, namespaces: new[] { "Zanshin.Areas.Forums.Controllers" });
        }
开发者ID:shoff,项目名称:zanshin,代码行数:30,代码来源:ForumsAreaRegistration.cs

示例6: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
           context.MapRoute(
                "ServerSentEvent_StatusChangeServerUpdate",
                "StatusChangeServerUpdate",
                new { controller = "User", action = "StatusChangeEvent", id = UrlParameter.Optional }
            );

            context.MapRoute(
                "ServerSent_AdminUserStatusChange",
                "UserStatusChange",
                new { controller = "Admin", action = "UserStatusChange", id = UrlParameter.Optional }
            );

            context.MapRoute(
                "ServerSent_AdminActionOnAll",
                "ActionOnAll",
                new { controller = "Admin", action = "ActionOnAll", id = UrlParameter.Optional }
            );

            context.MapRoute(
                "Html5_default",
                "Html5/{controller}/{action}/{id}",
                new { action = "Index", id = UrlParameter.Optional }
            );
        }
开发者ID:avijassra,项目名称:CodeLab,代码行数:26,代码来源:Html5AreaRegistration.cs

示例7: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                   "ForumHome",
                   "Forum/Home",
                   new { controller = "Home", action = "Index" },
                   new[] { "EstateSocialSystem.Web.Controllers" });

            context.MapRoute(
                "ForumLogOff",
                "Forum/Account/LogOff",
                new { controller = "Account", action = "LogOff" },
                new[] { "EstateSocialSystem.Web.Controllers" });

            context.MapRoute(
                "Get questions by tag",
                "questions/tagged/{tag}",
                new { controller = "Questions", action = "GetByTag" },
                new[] { "EstateSocialSystem.Web.Areas.Forum.Controllers" });

            context.MapRoute(
                "Display question",
                "questions/{id}",
                new { controller = "Questions", action = "Display" },
                new[] { "EstateSocialSystem.Web.Areas.Forum.Controllers" });

            context.MapRoute(
                "Forum_default",
                "Forum/{controller}/{action}/{id}",
                new { action = "Index", id = UrlParameter.Optional },
                new[] { "EstateSocialSystem.Web.Areas.Forum.Controllers" }
            );
        }
开发者ID:Georgegig,项目名称:EstateSocialSystem,代码行数:33,代码来源:ForumAreaRegistration.cs

示例8: RegisterArea

        /// <summary>
        /// Create the routes for the area
        /// </summary>
        /// <param name="context"></param>
        /// <remarks>
        /// By using the context to register the routes it means that the area is already applied to them all 
        /// and that the namespaces searched for the controllers are ONLY the ones specified.
        /// </remarks>
        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "Umbraco_back_office",
                GlobalSettings.UmbracoMvcArea + "/{action}/{id}",
                new {controller = "BackOffice", action = "Default", id = UrlParameter.Optional},
                //limit the action/id to only allow characters - this is so this route doesn't hog all other 
                // routes like: /umbraco/channels/word.aspx, etc...
                new
                    {
                        action = @"[a-zA-Z]*", 
                        id = @"[a-zA-Z]*"
                    },
                new[] {typeof (BackOfficeController).Namespace});

            //Create the install routes
            context.MapRoute(
                "Umbraco_install_packages",
                "Install/PackageInstaller/{action}/{id}",
                new {controller = "InstallPackage", action = "Index", id = UrlParameter.Optional},
                new[] {typeof (InstallPackageController).Namespace});
            
            //Create the REST/web/script service routes
            context.MapRoute(
                "Umbraco_web_services",
                GlobalSettings.UmbracoMvcArea + "/RestServices/{controller}/{action}/{id}",
                new {controller = "SaveFileController", action = "Index", id = UrlParameter.Optional},
                //look in this namespace for controllers
                new[] {"Umbraco.Web.WebServices"});
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:38,代码来源:BackOfficeArea.cs

示例9: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
            RegisterAreaEmbeddedResources();
            RegisterEmbeddedViewEngine();

            context.MapRoute(
                "ControlPanel_resources",
                "ControlPanel/{resourceType}/{resourceName}",
                new {controller = "EmbeddedResource", action = "Index"},
                new {resourceType = "^(Fonts|Scripts|Styles|Images)$"},
                new[] { "AzureWebFarm.ControlPanel.Areas.ControlPanel.Controllers" }
            );

            context.MapRoute(
                "ControlPanel_home",
                "",
                new {action = "Index", controller = "Home"},
                new[] { "AzureWebFarm.ControlPanel.Areas.ControlPanel.Controllers" }
            );

            context.MapRoute(
                "ControlPanel_default",
                "ControlPanel/{controller}/{action}/{id}",
                new { action = "Index", id = UrlParameter.Optional },
                new[] { "AzureWebFarm.ControlPanel.Areas.ControlPanel.Controllers" }
            );
        }
开发者ID:MRCollective,项目名称:AzureWebFarm,代码行数:27,代码来源:ControlPanelAreaRegistration.cs

示例10: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute("InvoiceEmail", "email/invoice/{orderGuid}/{orderId}", new { controller = "InvoiceEmail", action = "Index" });
            context.MapRoute("ContactUsEmail", "email/contact-us", new { controller = "ContactUsEmail", action = "Index" });

            context.MapRoute("Emails_default", "Emails/{controller}/{action}/{id}", new { action = "Index", id = UrlParameter.Optional });
        }
开发者ID:Brontsy,项目名称:Vintage-Rabbit,代码行数:7,代码来源:EmailsAreaRegistration.cs

示例11: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
               "Admin",
               "admin",
               new { controller = "Admin", action = "Default", lang = "ru" },
               new { lang = @"ru|en" },
               new[] { "Leo.Areas.Admin.Controllers" }
           );

            context.MapRoute(
               "Admin_Category",
               "{lang}/admin/{controller}/{action}/{id}",
               new { controller = "Admin", action = "Default", id = UrlParameter.Optional },
               new { lang = @"ru|en" },
               new[] { "Leo.Areas.Admin.Controllers" }
           );

            //context.MapRoute(
            //    "Admin_default",
            //    "admin/{controller}/{action}/{id}",
            //    new { controller = "Admin", action = "Default", id = UrlParameter.Optional},
            //    new[] { "Leo.Areas.Admin.Controllers" }
            //);
        }
开发者ID:fathurxzz,项目名称:aleqx,代码行数:25,代码来源:AdminAreaRegistration.cs

示例12: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "Blog_default",
                "{culture}/blog/",
                new { culture = string.Empty, area = "blog", controller = "Blog", action = "Index", id = UrlParameter.Optional },
                new { controller = "blog" },
                new string[] { "Horizon.Web.Areas.Blog.Controllers" });

            context.MapRoute(
                "blog-categories",
                "{culture}/blog/categories)",
                new { culture = string.Empty, area = "blog", controller = "blog", action = "Categories" },
                new { controller = "blog" },
                new string[] { "Horizon.Web.Areas.Blog.Controllers" });

            context.MapRoute(
              "blog-category-view",
              "{culture}/blog/category/{categoryname}",
              new { culture = string.Empty, area = "blog", Controller = "Blog", action = "Category", categoryname = UrlParameter.Optional },
               new { controller = "blog" },
                new string[] { "Horizon.Web.Areas.Blog.Controllers" });

            context.MapRoute(
               "blog-post-view",
               "{culture}/blog/{year}/{month}/{day}/{postname}",
               new { culture = string.Empty, area = "blog", controller = "blog", action = "Post", year = UrlParameter.Optional, month = UrlParameter.Optional, day = UrlParameter.Optional },
               new { controller = "blog" },
               new string[] { "Horizon.Web.Areas.Blog.Controllers" });
        }
开发者ID:emacho,项目名称:HorizonCMS,代码行数:30,代码来源:BlogAreaRegistration.cs

示例13: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "ReceivedBids",
                "Project/{id}/Bid/Received",
                new { controller = "Bid", action = "Received", id = UrlParameter.Optional },
                new { controller = @"Bid", action = "Received" },
                new[] { @"BCWeb.Areas.Project.Controllers" }
                );

            context.MapRoute(
                "InvitationRequests",
                "Project/{id}/Invitation/Requests",
                new { controller = "Invitation", action = "Requests", id = UrlParameter.Optional },
                new { controller = @"Invitation", action = "Requests" },
                new[] { @"BCWeb.Areas.Project.Controllers" }
                );

            context.MapRoute(
                "BidPackageInvite",
                "Project/BidPackage/{bidPackageId}/Invitation/Send",
                new { controller = "Invitation", action = "SendForBidPackage", bidPackageId = UrlParameter.Optional },
                new { controller = @"Invitation", action = "SendForBidPackage" },
                new[] { @"BCWeb.Areas.Project.Controllers" }
            );

            context.MapRoute(
                "Project_default",
                "Project/{controller}/{action}/{id}",
                new { action = "Index", id = UrlParameter.Optional },
                new { controller = @"BidPackage|Invitation|Bid|Document" },
                new[] { @"BCWeb.Areas.Project.Controllers" }
            );
        }
开发者ID:JoshIBrown,项目名称:BidChuck,代码行数:34,代码来源:ProjectsAreaRegistration.cs

示例14: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
               "ListShopsAll",
               "Api/Shops",
               new
               {
                   controller = "Shops",
                   action = "ShopsList",
                   page = UrlParameter.Optional,
                   count = UrlParameter.Optional
               }
               );
            context.MapRoute(
                "ListShopPaged",
                "Api/Shops/ShopsList/{pageNum}/{chunkSize}",
                new
                    {
                        controller = "Shops",
                        action = "ShopsList",
                        pageNum = UrlParameter.Optional,
                        chunkSize = UrlParameter.Optional
                    }
                );

            context.MapRoute(
                "Api_default",
                "Api/{controller}/{action}/{id}",
                new { action = "Index", id = UrlParameter.Optional }
            );
        }
开发者ID:hasanIqbalAnik,项目名称:store-survey,代码行数:31,代码来源:ApiAreaRegistration.cs

示例15: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "Search_default",
                "Search",
                new { controller = "Search", action = "ProcessSearchFormInput", id = UrlParameter.Optional, area = "Search" },
                new[] { "Destination2.WebUi.Search.Controllers" }
            );

            context.MapRoute(
                "PackageSerarchWaitFlight",
                "Search/Package-Flight-Wait",
                new { controller = "Wait", action = "FlightWait", id = UrlParameter.Optional, area = "Search" },
                new[] { "Destination2.WebUi.Search.Controllers" }
            );

            context.MapRoute(
                "PackageSerarchWaitFlightSearchStart",
                "Search/Package-Flight-Start",
                new { controller = "Wait", action = "FlightSearchStart", id = UrlParameter.Optional, area = "Search" },
                new[] { "Destination2.WebUi.Search.Controllers" }
            );

            context.MapRoute(
               "PackageSearchWaitFlightSearchStart",
               "Search/Package-Flight-Results",
               new { controller = "Results", action = "FlightResults", id = UrlParameter.Optional, area = "Search" },
               new[] { "Destination2.WebUi.Search.Controllers" }
               );
        }
开发者ID:Rafiq-Saleh,项目名称:Destination2,代码行数:30,代码来源:SearchAreaRegistration.cs


注:本文中的System.Web.Mvc.AreaRegistrationContext.MapRoute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。