當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。