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


C# Mvc.AreaRegistrationContext类代码示例

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


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

示例1: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
            // TRANSLATION ROUTING 
            CultureInfo cultureEN = CultureInfo.GetCultureInfo("en-US");
            CultureInfo cultureIT = CultureInfo.GetCultureInfo("it-IT");

            DictionaryRouteValueTranslationProvider translationProvider = new DictionaryRouteValueTranslationProvider(
                new List<RouteValueTranslation> {
                    //new RouteValueTranslation(cultureIT, "Document", "preventivi-commesse-tipografia"),
                    //new RouteValueTranslation(cultureIT, "ListEstimate", "elenco-documenti-centro-stampa"),
                    //new RouteValueTranslation(cultureIT, "CreateProduct", "inserimento-di-uno-stampato"),
                    //new RouteValueTranslation(cultureIT, "Error", "errore"),
                    //new RouteValueTranslation(cultureIT, "NoTaskEstimatedOnException", "manca-definizione-costo")
                }
            );

            context.MapTranslatedRoute(
                "Working_default",
                "working-area/{controller}/{action}/{id}",
                new { controller = "Working", action = "Index", id = UrlParameter.Optional },
                new { controller = translationProvider, action = translationProvider },
                true);

            //context.MapRoute(
            //    "Working_default",
            //    "Working/{controller}/{action}/{id}",
            //    new { action = "Index", id = UrlParameter.Optional }
            //);
        }
开发者ID:algola,项目名称:backup,代码行数:29,代码来源:WorkingAreaRegistration.cs

示例2: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
            RouteTable.Routes.LowercaseUrls = true;
            RouteTable.Routes.AppendTrailingSlash = true;

            //context.MapRoute(
            //    "Admin_editcategoryroute",
            //    "Admin/{controller}/{action}/{id}",
            //    new { controller = "AdminCategory", action = "Index", id = UrlParameter.Optional }
            //);
            //context.MapRoute(
            //    "Admin_edituserroute",
            //    "Admin/{controller}/{action}/{userId}",
            //    new { controller = "Admin", action = "Index", userId = UrlParameter.Optional }
            //);
            //context.MapRoute(
            //    "Admin_pagingroute",
            //    "Admin/{controller}/{action}/{page}",
            //    new { controller = "Account", action = "Index", page = UrlParameter.Optional }
            //);
            context.MapRoute(
                "Admin_defaultroute",
                "Admin/{controller}/{action}/{id}",
                new { controller = "Admin", action = "Index", id = UrlParameter.Optional }
            );
        }
开发者ID:huchao007,项目名称:mvcforum,代码行数:26,代码来源:AdminAreaRegistration.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)
 {
     //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

示例5: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "AdminAlbumList",
                "Admin/Album/List",
                new { controller = "AdminAlbumController", action = "List", id = UrlParameter.Optional }
            );

            context.MapRoute(
                "AdminAlbumCreate",
                "Admin/Album/Create",
                new { controller = "AlbumController", action = "Create", id = UrlParameter.Optional }
               );

            context.MapRoute(
                "AdminAlbumEdit",
                "Admin/Album/Edit/{id}",
                new { controller = "AdminAlbumController", action = "Edit", id = UrlParameter.Optional }
            );

            context.MapRoute(
                "AdminAlbumDelete",
                "Admin/Album/Delete/{id}",
                new { controller = "AdminAlbumController", action = "Delete" }
            );

            context.MapRoute(
                "Admin_default",
                "Admin/{controller}/{action}/{id}",
                new { action = "Index", id = UrlParameter.Optional }
            );
        }
开发者ID:N7i,项目名称:NwdStudents,代码行数:32,代码来源:AdminAreaRegistration.cs

示例6: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                null,
                url: "Error",
                defaults: new { controller = "Error", action = "Index", id = UrlParameter.Optional },
                namespaces: new[] { "LessonProject.Areas.Default.Controllers" }
            );

            context.MapRoute(
                null,
                url: "NotFoundPage",
                defaults: new { controller = "Error", action = "NotFoundPage", id = UrlParameter.Optional },
                namespaces: new[] { "LessonProject.Areas.Default.Controllers" }
            );

            context.MapRoute(
                name: "lang",
                url: "{lang}/{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                constraints : new { lang = @"ru|en" },
                namespaces: new[] { "LessonProject.Areas.Default.Controllers" }
            );

            context.MapRoute(
                name : "default",
                url : "{controller}/{action}/{id}",
                defaults : new { controller = "Home", action = "Index", id = UrlParameter.Optional, lang = "ru" },
                namespaces : new [] { "LessonProject.Areas.Default.Controllers" }
            );
        }
开发者ID:jorik041,项目名称:lessons-asp-mvc,代码行数:31,代码来源:DefaultAreaRegistration.cs

示例7: RegisterArea

 public override void RegisterArea(AreaRegistrationContext context)
 {
     context.MapRoute(
       name: "Public_default",
         url: "{controller}/{action}/{id}",
         defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional });
 }
开发者ID:MariyaSteffanova,项目名称:EcoMaster,代码行数:7,代码来源:PublicAreaRegistration.cs

示例8: RegisterArea

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "AdminIdeasRoute",
                "Ideas/Admin/{action}/{id}",
                new { controller = "AdminIdeas", action = "Index", id = UrlParameter.Optional },
                new[] { "SampArch.Presentation.Area.Ideas.Controllers" }

            );

            context.MapRoute(
                "IdeasRoute",
                "Ideas/{action}/{id}",
                new { controller = "SiteIdeas", action = "Index", id = UrlParameter.Optional },
                new[] { "SampArch.Presentation.Area.Ideas.Controllers" }

            );

            context.MapRoute(
                "IdeasServiceRoute",
                "IdeasService/{action}/{id}",
                new { controller = "IdeasService", action = "DownloadCsv", id = UrlParameter.Optional },
                new[] { "SampArch.Presentation.Area.Ideas.Controllers" }

            );
        }
开发者ID:rhwy,项目名称:SampArch,代码行数:26,代码来源:IdeaAreaRegistration.cs

示例9: CuiAreaRegistration_RegisterArea_CuiRouteAdded_DataTokensSet

        public void CuiAreaRegistration_RegisterArea_CuiRouteAdded_DataTokensSet()
        {
            // arrange
            const string areaName = "CUI";
            const string routeName = "CUI_default";

            RouteCollection routes = new RouteCollection();
            AreaRegistrationContext context = new AreaRegistrationContext(areaName, routes); 
            var registration = new CuiAreaRegistration();
            
            // act
            registration.RegisterArea(context);

            // assert
            var route = context.Routes[routeName] as Route;
            
            Assert.IsNotNull(route);
            Assert.AreEqual("CUI/{controller}/{action}/{id}", route.Url);
            Assert.AreEqual("Main", route.Defaults["controller"]);
            Assert.AreEqual("Index", route.Defaults["action"]);
            Assert.AreEqual(areaName, route.Defaults["area"]);
            Assert.AreEqual(UrlParameter.Optional, route.Defaults["id"]);
            Assert.AreEqual("Login", route.DataTokens["LoginController"]);
            Assert.AreEqual("Index", route.DataTokens["LoginAction"]);
            Assert.AreEqual(areaName, registration.AreaName);
            Assert.AreEqual(areaName, context.AreaName);
        }
开发者ID:Exclr8,项目名称:CloudCore,代码行数:27,代码来源:CuiAreaRegistrationTests.cs

示例10: RegisterArea

 public override void RegisterArea(AreaRegistrationContext context)
 {
     context.MapRoute(
         name: AreaName + "-Default",
         url: "admin/raven/{action}/{id}",
         defaults: new { controller = "RavenAdmin", action = "Index", id = UrlParameter.Optional });
 }
开发者ID:jalchr,项目名称:brnkly,代码行数:7,代码来源:RavenAreaRegistration.cs

示例11: 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

示例12: RegisterArea

 protected override void RegisterArea(
     AreaRegistrationContext context,
     IApplicationBus bus,
     PlatformAreaRegistrationState state)
 {
     this.RegisterApplicationRoutes(context);
 }
开发者ID:paulkearney,项目名称:brnkly,代码行数:7,代码来源:AdministrationAreaRegistration.cs

示例13: RegisterApplicationRoutes

 protected void RegisterApplicationRoutes(AreaRegistrationContext context)
 {
     context.MapRoute(
         "AdminHome-Default",
         "",
         new { controller = "Admin", action = "Index" });
 }
开发者ID:paulkearney,项目名称:brnkly,代码行数:7,代码来源:AdministrationAreaRegistration.cs

示例14: RegisterArea

 public override void RegisterArea(AreaRegistrationContext context)
 {
     Config config = Config.Load();
     context.MapSubdomainRoute(
          "Error.Http404", // Route name
          new List<string>() { "*", "error" }, // Subdomains
          new List<string>() { config.Host }, // domains
          "404",    // URL with parameters 
          new { controller = "Error", action = "Http404" },  // Parameter defaults 
          new[] { typeof(Controllers.ErrorController).Namespace }
      );
     context.MapSubdomainRoute(
          "Error.Http403", // Route name
          new List<string>() { "*", "error" }, // Subdomains
          new List<string>() { config.Host }, // domains
          "403",    // URL with parameters 
          new { controller = "Error", action = "Http403" },  // Parameter defaults 
          new[] { typeof(Controllers.ErrorController).Namespace }
      );
     context.MapSubdomainRoute(
          "Error.Http500", // Route name
          new List<string>() { "*", "error" }, // Subdomains
          new List<string>() { config.Host }, // domains
          "500",    // URL with parameters 
          new { controller = "Error", action = "Http500" },  // Parameter defaults 
          new[] { typeof(Controllers.ErrorController).Namespace }
      );
 }
开发者ID:Teknikode,项目名称:Teknik,代码行数:28,代码来源:ErrorAreaRegistration.cs

示例15: 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


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