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


C# RouteCollection.Remove方法代码示例

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


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

示例1: RegisterRoutes

        public void RegisterRoutes(RouteCollection routes)
        {
            ViewEngines.Engines.Add(new CustomViewEngine());
            var routeArticleGroupAdmin = routes.MapRoute("Plugin.Misc.Articles.ArticleGroup.Admin",
                "Admin/ArticleGroup/{action}/{id}",
                new { controller = "ArticleGroup", action = "Index", id = UrlParameter.Optional },
                new[] { "Toi.Plugin.Misc.Articles.Controllers" }
                );
            routeArticleGroupAdmin.DataTokens.Add("area", "admin");
            routes.Remove(routeArticleGroupAdmin);
            routes.Insert(0, routeArticleGroupAdmin);

            var routeArticleAdmin = routes.MapRoute("Plugin.Misc.Articles.Article.Admin",
                "Admin/Article/{action}/{id}",
                new { controller = "Article", action = "Index", id = UrlParameter.Optional },
                new[] { "Toi.Plugin.Misc.Articles.Controllers" }
                );
            routeArticleAdmin.DataTokens.Add("area", "admin");
            routes.Remove(routeArticleAdmin);
            routes.Insert(0, routeArticleAdmin);
            //routes.MapRoute("ArticleAdmin",
            //      "Admin/Plugins/ArticleManagement/ArticleAdmin/{action}/{id}",
            //      new { controller = "ArticleAdmin", action = "Index", id = UrlParameter.Optional },
            //      new[] { "Nop.Plugin.Other.ArticleManagement.Controllers" }
            // ).DataTokens.Add("area", "admin"); ;
        }
开发者ID:phatnguyen81,项目名称:vlsaomai,代码行数:26,代码来源:RouteProvider.cs

示例2: MapRoutes

        private static void MapRoutes(RouteCollection routes)
        {
            var routeBase = routes["CreatePackage"];
            routes.Remove(routeBase);
            routes.Remove(routes["CreatePackage-Root"]);

            routes.MapDelegate("Override_CreatePackage",
                "api/v2/package",
                new { httpMethod = new HttpMethodConstraint("PUT") },
                context => CreateSymbolService().CreatePackage(context.HttpContext));

            routes.MapDelegate("Override_CreatePackage-Root",
                "",
                new { httpMethod = new HttpMethodConstraint("PUT") },
                context => CreateSymbolService().CreatePackage(context.HttpContext));

            routes.MapDelegate("GetSymbols",
                "symbols/{*path}",
                new {httpMethod = new HttpMethodConstraint("GET")},
                context =>CreateSymbolService().GetSymbols(context));

            routes.MapDelegate("GetSource",
                "source/{id}/{version}/{*path}",
                new {httpMethod = new HttpMethodConstraint("GET")},
                context => CreateSymbolService().GetSource(context));
        }
开发者ID:fhchina,项目名称:nupeek,代码行数:26,代码来源:NuPeek.cs

示例3: RegisterRoutes

        public void RegisterRoutes(RouteCollection routes)
        {
            var route = routes.MapRoute("Plugin.Tameion.Auctions.Public.AuctionsController",
                "Auctions/{action}/{id}",
                new { area = "Public", controller = "Auctions", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Tameion.Auctions.Areas.Public.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Tameion.Auctions.Vendor.AuctionsController",
                "Vendor/Auctions/{action}/{id}",
                new { area = "Vendor", controller = "Auctions", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Tameion.Auctions.Areas.Vendor.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            route = routes.MapRoute("Plugin.Tameion.Auctions.Admin.AuctionsController",
                "Admin/Auctions/{action}/{id}",
                new { area = "Admin", controller = "Auctions", action = "Index", id = UrlParameter.Optional },
                new[] { "Nop.Plugin.Tameion.Auctions.Areas.Admin.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

            ViewEngines.Engines.Insert(0, new CustomViewEngine());
        }
开发者ID:mhsohail,项目名称:Livetameion_3.7,代码行数:28,代码来源:RouteConfig.cs

示例4: InstallRoutes

        static void InstallRoutes(RouteCollection routes)
        {
            var assetRoute = new Route("_instantcss/assets/{*path}", new AssetRouteHandler());
            routes.Insert(0, assetRoute);

            var connectionRoute = routes.MapConnection<ExpressCssConnection>("ExpressCss", "_instantcss/connection/{*operation}");
            routes.Remove(connectionRoute);
            routes.Insert(1, connectionRoute);
        }
开发者ID:modulexcite,项目名称:expresscss,代码行数:9,代码来源:Application.cs

示例5: RegisterRoutes

 public void RegisterRoutes(RouteCollection routes)
 {
     var robotsTxtRoute = RouteTable.Routes["robots.txt"];
     routes.Remove(robotsTxtRoute);
     
     routes.MapRoute("robots.txt",
                     "robots.txt",
                     new { controller = "RobotsTxt", action = "RobotsTextFile" },
                     new[] { "Nop.Plugin.Misc.CustomRobotsTxt.Controllers" });
 }
开发者ID:ilich,项目名称:Nop.Plugin.Misc.CustomRobotsTxt,代码行数:10,代码来源:RouteProvider.cs

示例6: RegisterRoutes

        public void RegisterRoutes(RouteCollection routes)
        {
            ViewEngines.Engines.Insert(0, new PluginViewEngine());
            //contact us example

               var  route = routes.MapRoute("ContactUsCustom","contactus",
            new { controller = "ContactUs", action = "ContactUs" },
            namespaces: new[] { "Nop.Plugins.MyStore.Controllers" }
            );
            routes.Remove(route);
            routes.Insert(0, route);

              route = routes.MapRoute("ProductExtendedFields",
              "Admin/Category/ProductExtendedFields/{productId}",
              new { controller = "ExtendedFields", action = "ProductExtendedFields" },
              new[] { "Nop.Plugins.MyStore.Controllers" }
              );

            route.DataTokens.Add("area", "admin");
            routes.Remove(route);
            routes.Insert(0, route);
        }
开发者ID:yarik-uteam,项目名称:MyStore,代码行数:22,代码来源:RouteProvider.cs

示例7: RegisterNoAccountRoutes

        public static void RegisterNoAccountRoutes(RouteCollection routes)
        {
            if (routes == null)
            {
                throw new ArgumentNullException("routes");
            }

            RegisterRoutes(routes);

            // deregister the non SPA MVC route, and replace it with a redirect to Functions Homepage so
            // the user would get the helpful error.
            var legacyRoute = routes.OfType<Route>().First(r => r.Url == FunctionController.LegacyNonSpaRouteUrl);
            routes.Remove(legacyRoute);
            routes.Add(new Route(FunctionController.LegacyNonSpaRouteUrl, new RedirectRouteHandler("~/#/functions")));
        }
开发者ID:rafaelmtz,项目名称:azure-webjobs-sdk,代码行数:15,代码来源:RouteConfig.cs

示例8: MapRoutes

        private static void MapRoutes(RouteCollection routes)
        {
            // The default route is http://{root}/nuget/Packages
            var factory = new DataServiceHostFactory();
            var serviceRoute = new ServiceRoute("nuget", factory, typeof(Packages));
            serviceRoute.Defaults = new RouteValueDictionary { { "serviceType", "odata" } };
            serviceRoute.Constraints = new RouteValueDictionary { { "serviceType", "odata" } };
            routes.Add("nuget", serviceRoute);

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

            // For some godforsaken reason, the PublishPackage route (registered by NuGet.Server) causes the { controller, action } => url mapping to always return this route.
            routes.Remove(routes.OfType<Route>().Single(r => r.DataTokens != null && r.DataTokens.ContainsKey("__RouteName") && (string)r.DataTokens["__RouteName"] == "PublishPackage"));
        }
开发者ID:erik-kallen,项目名称:NuGetServer,代码行数:18,代码来源:ApplicationBootstrapper.cs

示例9: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            //调整route顺序
            var tempRoutes = new List<RouteBase>();
            foreach (var item in routes.Where(r => r.GetType() == typeof(Route)))
            {
                var url = (item as Route).Url.Trim('/');
                if (url.Split('/')[0].IndexOf("{") >= 0)
                    tempRoutes.Add(item);
            }
            
            routes.MapPageRoute("Report", "report", "~/Content/page/report.aspx");
 
            routes.MapRoute(
                name: "Resource",
                url: "Resource/{assemblyName}/{*fileName}",
                defaults: new { controller = "Resource", action = "Index" },
                namespaces: new string[] { "Zephyr.Web.Mvc.Controllers" }
            );
 
            routes.MapRoute(
                name: "WebMvcDefault",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
                namespaces: new string[] { "Zephyr.Web.Mvc.Controllers" }
            );

            foreach (var item in tempRoutes)
            {
                routes.Remove(item);
                routes.Add(item);
            }
 
            ModelBinders.Binders.Add(typeof(JObject), new JObjectModelBinder()); //for dynamic model binder
        }
开发者ID:uwitec,项目名称:web-mvc-logistics,代码行数:37,代码来源:RouteConfig.cs

示例10: UpdateRoute

 private void UpdateRoute(RouteCollection routes, string routeName,
     string url, string controllerName, string actionName, string namespaces)
 {
     var route = routes[routeName] as LocalizedRoute;
     if (route != null)
     {
         routes.Remove(route);
     }
     routes.MapLocalizedRoute(routeName, url, new { controller = controllerName, action = actionName },
         new[] { namespaces });
 }
开发者ID:AlexandrKiselev79,项目名称:LLT_Site,代码行数:11,代码来源:RouteProvider.cs

示例11: RegisterRoutes

        public void RegisterRoutes(RouteCollection routes)
        {
            #region Custom View Engine

            global::System.Web.Mvc.ViewEngines.Engines.Insert(0, new PromoViewEngine());

            #endregion

            // Main Banner List
            var promoBanner = routes.MapRoute("Qixol.Promos.PromoBanner",
                    "Admin/PromoBanner/Admin/Banner/Index",
                    new { controller = "PromoBanner", action = "Index" },
                    new[] { "Qixol.Plugin.Widgets.Promo.Controllers" }
            );
            promoBanner.DataTokens.Add("area", "admin");

            // For a banner, PICTURES - retrieve / add /  edit / delete
            var promoBannerList = routes.MapRoute("Qixol.Promos.PromoBanner.List",
                    "Admin/PromoBanner/Admin/Banner/List",
                    new { controller = "PromoBanner", action = "BannerPicturesList" },
                    new[] { "Qixol.Plugin.Widgets.Promo.Controllers" }
            );
            promoBannerList.DataTokens.Add("area", "admin");

            var promoBannerAdd = routes.MapRoute("Qixol.Promos.PromoBanner.Add",
                    "Admin/PromoBanner/Admin/Banner/Add",
                    new { controller = "PromoBanner", action = "BannerPictureAdd" },
                    new[] { "Qixol.Plugin.Widgets.Promo.Controllers" }
            );
            promoBannerAdd.DataTokens.Add("area", "admin");

            var promoBannerEdit = routes.MapRoute("Qixol.Promos.PromoBanner.Edit",
                    "Admin/PromoBanner/Admin/Banner/Edit",
                    new { controller = "PromoBanner", action = "BannerPictureEdit" },
                    new[] { "Qixol.Plugin.Widgets.Promo.Controllers" }
            );
            promoBannerEdit.DataTokens.Add("area", "admin");

            var promoBannerDelete = routes.MapRoute("Qixol.Promos.PromoBanner.Delete",
                    "Admin/PromoBanner/Admin/Banner/Delete",
                    new { controller = "PromoBanner", action = "BannerPictureDelete" },
                    new[] { "Qixol.Plugin.Widgets.Promo.Controllers" }
            );
            promoBannerDelete.DataTokens.Add("area", "admin");

            // For a Banner, WIDGET ZONES - retrieve / add /  edit / delete
            var promoBannerWidgetZoneList = routes.MapRoute("Qixol.Promos.PromoBanner.WidgetZoneList",
                    "Admin/PromoBanner/Admin/Banner/WidgetZoneList",
                    new { controller = "PromoBanner", action = "BannerWidgetZonesList" },
                    new[] { "Qixol.Plugin.Widgets.Promo.Controllers" }
            );
            promoBannerWidgetZoneList.DataTokens.Add("area", "admin");

            var promoBannerWidgetZoneAdd = routes.MapRoute("Qixol.Promos.PromoBanner.WidgetZoneAdd",
                    "Admin/PromoBanner/Admin/Banner/AddWidgetZone",
                    new { controller = "PromoBanner", action = "BannerWidgetZoneAdd" },
                    new[] { "Qixol.Plugin.Widgets.Promo.Controllers" }
            );
            promoBannerWidgetZoneAdd.DataTokens.Add("area", "admin");

            var promoBannerWidgetZoneDelete = routes.MapRoute("Qixol.Promos.PromoBanner.WidgetZoneDelete",
                    "Admin/PromoBanner/Admin/Banner/DeleteWidgetZone",
                    new { controller = "PromoBanner", action = "BannerWidgetZoneDelete" },
                    new[] { "Qixol.Plugin.Widgets.Promo.Controllers" }
            );
            promoBannerWidgetZoneDelete.DataTokens.Add("area", "admin");

            var accountIssuedCoupons = routes.MapRoute("CustomerIssuedCoupons",
                    "customer/issuedcoupons",
                    new { controller = "PromoCustomerCoupon", action = "CustomerIssuedCoupons" },
                    new[] { "Qixol.Plugin.Misc.Wdigets.Controllers" }
            );
            routes.Remove(accountIssuedCoupons);
            routes.Insert(0, accountIssuedCoupons);
 
        }
开发者ID:Qixol,项目名称:Qixol.Promo.Nop.Plugin,代码行数:76,代码来源:RouteProvider.cs

示例12: RegisterRoutes

        public void RegisterRoutes(RouteCollection routes)
        {
            #region Custom View Engine

            global::System.Web.Mvc.ViewEngines.Engines.Insert(0, new PromoViewEngine());

            #endregion

            #region admin routes

            var promosProductFeedRoute = routes.MapRoute("Qixol.Promos.GenerateFeed",
                    "Admin/PromosFeed/Admin/Feed/PromosFeed",
                    new { controller = "PromoAdmin", action = "GenerateFeed" },
                    new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
            );
            promosProductFeedRoute.DataTokens.Add("area", "admin");

            var adminDiscountRoute = routes.MapRoute("QixolPromosAdminDiscount",
                    "Admin/Discount/{action}/{id}",
                    new { controller = "AdminDiscount", action = "Index", id = "", area = "PromoAdmin" },
                    new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
            );
            adminDiscountRoute.DataTokens.Add("area", "admin");
            routes.Remove(adminDiscountRoute);
            routes.Insert(0, adminDiscountRoute);

            #endregion

            #region website routes

            routes.MapRoute("PromoContinueShopping",
                "checkout/continueshopping",
                new { controller = "Checkout", action = "ContinueShopping" },
                new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
                );

            var promosShoppingCartRoute = routes.MapRoute("PromosShoppingCart",
                    "cart/",
                    new { controller = "ShoppingCart", action = "Cart" },
                    new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
                    );
            routes.Remove(promosShoppingCartRoute);
            routes.Insert(0, promosShoppingCartRoute);

            var promosCheckoutRoute = routes.MapRoute("PromoCheckout",
                    "checkout",
                    new { controller = "PromoCheckout", action = "PromoIndex" },
                    new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
                    );
            routes.Remove(promosCheckoutRoute);
            routes.Insert(0, promosCheckoutRoute);

            var promosCheckoutShippingMethodRoute = routes.MapRoute("PromoCheckoutShippingMethod",
                    "checkout/shippingmethod",
                    new { controller = "Checkout", action = "ShippingMethod" },
                    new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
                    );
            routes.Remove(promosCheckoutShippingMethodRoute);
            routes.Insert(0, promosCheckoutShippingMethodRoute);

            var promosCheckoutOpcSaveShippingRoute = routes.MapRoute("PromoCheckoutOpcSaveShipping",
                    "checkout/OpcSaveShipping",
                    new { controller = "Checkout", action = "OpcSaveShipping" },
                    new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
                    );
            routes.Remove(promosCheckoutOpcSaveShippingRoute);
            routes.Insert(0, promosCheckoutOpcSaveShippingRoute);

            var promosCheckoutOnePageRoute = routes.MapRoute("PromoCheckoutOnePage",
                    "onepagecheckout/",
                    new { controller = "Checkout", action = "PromoOnePageCheckout" },
                    new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
                    );
            //routes.Remove(promosCheckoutOnePageRoute);
            //routes.Insert(0, promosCheckoutOnePageRoute);

            var missedPromotionsRoute = routes.MapRoute("PromoCheckoutMissedPromotions",
                    "checkout/missedpromotions",
                    new { controller = "PromoCheckout", action = "MissedPromotions" },
                    new[] { "Qixol.Plugin.Misc.Promo.Controllers" }
                    );
            // do NOT remove and reinsert - loses name

            #endregion
        }
开发者ID:Qixol,项目名称:Qixol.Promo.Nop.Plugin,代码行数:85,代码来源:RouteProvider.cs

示例13: InsertNewMapRoute

        private void InsertNewMapRoute(RouteCollection routes, string name, string url, string controllerName, string actionName, object routeParams = null, bool isAdmin = true, bool expectsId = false, bool insertAtZeroRoute = true)
        {
            object controllerParams = null;
            if (!expectsId)
                controllerParams = new { controller = controllerName, action = actionName };
            else
            {
                controllerParams = new { controller = controllerName, action = actionName, Id = UrlParameter.Optional };
                if (routeParams == null)
                    routeParams = new { id = @"\d+" };
            }

            var newMapRoute = routes.MapRoute(name, url, controllerParams, routeParams, new[] { "Qixol.Nop.Controllers" } );

            if(isAdmin)
                newMapRoute.DataTokens.Add("area", "admin");

            if (insertAtZeroRoute)
            {
                routes.Remove(newMapRoute);
                routes.Insert(0, newMapRoute);
            }
        }
开发者ID:Qixol,项目名称:Qixol.Promo.Nop.Plugin,代码行数:23,代码来源:RouteProvider.cs

示例14: IndexForNonExistentAfterRemoval

		public void IndexForNonExistentAfterRemoval ()
		{
			var c = new RouteCollection ();
			var r = new Route (null, null);
			c.Add ("x", r);
			c.Remove (r);
			Assert.IsNull(c ["x"]);
		}
开发者ID:carrie901,项目名称:mono,代码行数:8,代码来源:RouteCollectionTest.cs

示例15: InsertRoute

 private void InsertRoute(RouteCollection routes, RouteBase route)
 {
     routes.Remove(route);
     routes.Insert(0, route);
 }
开发者ID:tomvanenckevort,项目名称:NopCommerce.MultipleParentCategories,代码行数:5,代码来源:MultipleParentsAreaRegistration.cs


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