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


C# RouteCollection.Ignore方法代码示例

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


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

示例1: Register404Route

        /// <summary>
        /// Registers C1's 404 route that catches all requests. 
        /// This method should be called only after all other routes are registered.
        /// </summary>
        public static void Register404Route(RouteCollection routes)
        {
            // Ignoring routes that shouldn't be caught by 404 handler
            routes.Ignore("Renderers/{*pathInfo}");
            routes.Ignore("{*all_css_aspx}", new { all_css_aspx = @".*\.css.aspx(/.*)?" });

            routes.Add("c1 404 route", new PageNotFoundRoute());
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:12,代码来源:Routes.cs

示例2: RegisterRoutes

 internal static void RegisterRoutes(RouteCollection routes)
 {
     if (routes != null)
     {
         Log.Information("Registering routes.");
         routes.Ignore("{resource}.axd");
         routes.Ignore("{*url}", new { url = @".*\.asmx(/.*)?" });
         routes.MapPageRoute("DefaultRoute", "", "~/SignIn.aspx");
         routes.MapPageRoute("Reporting", "Reports/{path}", "~/Reports/ReportMaster.aspx");
         routes.MapPageRoute("Modules", "Modules/{*path}", "~/Modules/Default.aspx");
     }
 }
开发者ID:nubiancc,项目名称:mixerp,代码行数:12,代码来源:Routes.cs

示例3: IgnoreIgnoreRoutes

		public void IgnoreIgnoreRoutes()
		{
			var routeCollection = new RouteCollection();
			routeCollection.Ignore("IgnoreMe");
			var filter = new IgnoreUnsupportedRoutesFilter();
			Assert.IsFalse(filter.AllowRoute(routeCollection[0]));
		}
开发者ID:modulexcite,项目名称:RouteJs,代码行数:7,代码来源:IgnoreUnsupportedRoutesFilterTests.cs

示例4: RegisterRoutes

        // register routes with routing system.

        private static void RegisterRoutes(RouteCollection routes)
        {
            // note: the order in which routes are registered is important.

            routes.Ignore("{resource}.axd/{*pathInfo}");

            routes.MapPageRoute("Error", "error", "~/Error.aspx");

            routes.MapPageRoute("Login", "login", "~/WebAuth/Login.aspx");
            routes.MapPageRoute("Logout", "logout", "~/WebAuth/Logout.aspx");

            routes.MapPageRoute("Shop", "shop", "~/WebShop/Shopping.aspx");
            routes.MapPageRoute("Products", "shop/products", "~/WebShop/Products.aspx");
            routes.MapPageRoute("Product", "shop/products/{productid}", "~/WebShop/Product.aspx");
            routes.MapPageRoute("Search", "shop/search", "~/WebShop/Search.aspx");
            routes.MapPageRoute("Cart", "shop/cart", "~/WebShop/Cart.aspx");
            routes.MapPageRoute("Checkout", "shop/checkout", "~/WebShop/Checkout.aspx");

            routes.MapPageRoute("Admin", "admin", "~/WebAdmin/Admin.aspx");
            routes.MapPageRoute("Orders", "admin/members/orders", "~/WebAdmin/Orders.aspx");
            routes.MapPageRoute("Order", "admin/members/{memberid}/orders", "~/WebAdmin/Order.aspx");
            routes.MapPageRoute("Details", "admin/members/{memberid}/orders/{orderid}/details", "~/WebAdmin/OrderDetails.aspx");
            routes.MapPageRoute("Member", "admin/members/{memberid}", "~/WebAdmin/Member.aspx");
            routes.MapPageRoute("Members", "admin/members", "~/WebAdmin/Members.aspx");

            routes.MapPageRoute("Default", "", "~/Default.aspx");
        }
开发者ID:tuansolo,项目名称:CodeBase,代码行数:29,代码来源:Global.asax.cs

示例5: RegisterRoutes

 public static void RegisterRoutes(RouteCollection routes)
 {
     var settings = new FriendlyUrlSettings();
     settings.AutoRedirectMode = RedirectMode.Permanent;
     routes.EnableFriendlyUrls(settings);
     routes.Ignore("*.img");
 }
开发者ID:Vyara,项目名称:Telerik-Academy,代码行数:7,代码来源:RouteConfig.cs

示例6: RegisterRoutes

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

            routes.MapPageRoute(
                "SalesSummaryRoute",
                "SalesReportSummary/{year}",
                "~/SalesSummary.aspx",
                true,
                new RouteValueDictionary { }
            );

            var route = routes.MapPageRoute(
                "SalesRoute",
                "SalesReport/{locale}/{year}",
                "~/Sales.aspx",
                true,
                new RouteValueDictionary { }
            );
            route.RouteHandler = new PageRouteHandler("~/Sales.aspx");

            routes.MapPageRoute(
                "ExpensesRoute",
                "ExpenseReport/{locale}/{year}/{*extraInfo}",
                "~/Expenses.aspx",
                true,
                new RouteValueDictionary { },
                new RouteValueDictionary { { "extraInfo", new CharactersConstraint() } }
            );
        }
开发者ID:gabla5,项目名称:SO-Answers,代码行数:30,代码来源:Global.asax.cs

示例7: RegisterRoutes

 public static void RegisterRoutes(RouteCollection routes)
 {
     routes.RouteExistingFiles = false;
     routes.IgnoreRoute("WebApp/{*pathInfo}");
     routes.Ignore("favicon.ico");
     routes.MapRoute("", "{*mapUri}", new { controller = "App", action = "Render" });
 }
开发者ID:pazof,项目名称:MonoCross,代码行数:7,代码来源:Global.asax.cs

示例8: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            // Нормализация виртуальных путей для оптимизации SEO
            routes.AppendTrailingSlash = true;
            routes.LowercaseUrls = true;

            // Игнорирование путей
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.Ignore("css/{*pathInfo}");
            routes.Ignore("js/{*pathInfo}");
            routes.Ignore("img/{*pathInfo}");
            routes.Ignore("error/forbidden.html");
            routes.Ignore("error/gatewaytimeout.html");
            routes.Ignore("error/serviceunavailable.html");
            routes.Ignore("humans.txt");

            // Включение маршрутов по аттрибутам
            routes.MapMvcAttributeRoutes();

            // Данный маршрут нужен только для системы логирования Elmah.MVC.
            // У этой системы есть баг, из-за которого некоторые 404 и 500 ошибки не логируются без
            // регистрации такого маршрута.
            // https://github.com/alexbeletsky/elmah-mvc/issues/60
            // https://github.com/RehanSaeed/ASP.NET-MVC-Boilerplate/issues/8
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional });
        }
开发者ID:ZeVS777,项目名称:WebFromScratch,代码行数:29,代码来源:RouteConfig.cs

示例9: RegisterRoutes

        private void RegisterRoutes(RouteCollection routes)
        {
            routes.Ignore("{resource}.axd/{*pathInfo}");

            routes.MapPageRoute("User routes", "{username}", "~/Routes.aspx", true, null,
                new RouteValueDictionary { { "username", "[a-zA-Z].*" } });

            routes.MapPageRoute("Route map", "{username}/{routeId}", "~/Map.aspx");
        }
开发者ID:spaetzel,项目名称:CanMan,代码行数:9,代码来源:Global.asax.cs

示例10: RegisterRoutes

        /// <summary>
        /// </summary>
        /// <param name="routes"></param>
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.Ignore("{resource}.axd/{*pathInfo}");

            #if DEBUG // Mapeia as rotas customizadas para tela default.
            routes.MapPageRoute("Documentation_Login", "", "~/Views/Documentation/Login.html");
            routes.MapPageRoute("Documentation_Sandbox", "Sandbox/", "~/Views/Documentation/Sandbox.html");
            #endif
        }
开发者ID:viniciusstroher,项目名称:animalsAPI,代码行数:12,代码来源:RouteConfig.cs

示例11: IgnoredRoutesDoNotThrowAnException

        public void IgnoredRoutesDoNotThrowAnException()
        {
            var config = new Mock<IConfiguration>();

            var routeCollection = new RouteCollection();
            routeCollection.Ignore("IgnoreMe");
            var routeFilter = new MvcRouteFilter(config.Object, routeCollection);
            Assert.DoesNotThrow(() => routeFilter.AllowRoute(routeCollection[0]));
        }
开发者ID:jni-,项目名称:RouteJs,代码行数:9,代码来源:MvcRouteFilterTests.cs

示例12: RegisterRoutes

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

            foreach (IRouteRegistrar routeRegistrar in GetRouteRegistrars())
            {
                routeRegistrar.RegisterRoute(routes);
            }
        }
开发者ID:vkoppaka,项目名称:Restfinity,代码行数:9,代码来源:RouteRegistrar.cs

示例13: RegisterRoutes

        public static void RegisterRoutes(RouteCollection routes)
        {
            //friendly url
            var settings = new FriendlyUrlSettings
            {
                AutoRedirectMode = RedirectMode.Permanent,
                ResolverCachingMode = ResolverCachingMode.Dynamic
            };
            routes.EnableFriendlyUrls(settings);
            //ignore routes
            routes.Ignore("{resource}.axd/{*pathInfo}");
            // routs
            routes.MapPageRoute("EditArticle", "User/Articles/Edit/{id}",
               "~/Managements/Articles/Edit.aspx", true, null, new RouteValueDictionary { { "id", @"\d+" } });
            routes.MapPageRoute("DeleteArticle", "User/Articles/Delete/{id}",
             "~/Managements/Articles/Delete.aspx", true, null, new RouteValueDictionary { { "id", @"\d+" } });
            routes.MapPageRoute("ShowArticles", "User/Articles/Show",
             "~/Managements/Articles/Default.aspx", true, null, null);
            routes.MapPageRoute("InsertArticle", "User/Articles/Insert",
               "~/Managements/Articles/Insert.aspx", true, null, null);

            routes.MapPageRoute("DeleteComment", "Forum/Topic/{topicId}/post/Comments/{id}",
             "~/Managements/Comments/Delete.aspx", true, null, new RouteValueDictionary { { "id", @"\d+" }, { "topicId", @"\d+" } });
            routes.MapPageRoute("AddComment", "Forum/Topic/{topicId}/post/{postId}/NewComment",
              "~/Managements/Comments/Insert.aspx", true, null, new RouteValueDictionary { { "postId", @"\d+" }, { "topicId", @"\d+" } });

            routes.MapPageRoute("DeletePost", "Forums/Topic/{topicId}/Posts/Delete/{id}",
               "~/Managements/ForumPost/Delete.aspx", true, null, new RouteValueDictionary { { "id", @"\d+" }, { "topicId", @"\d+" } });
            routes.MapPageRoute("EditPost", "Forums/Topic/{topicId}/Posts/Edit/{id}",
               "~/Managements/ForumPost/Edit.aspx", true, null, new RouteValueDictionary { { "id", @"\d+" },  { "topicId", @"\d+" } });

            routes.MapPageRoute("ChangePass", "User/ChangePass", "~/Account/ChangePass.aspx", true);
            routes.MapPageRoute("Confirm", "Confirm", "~/Account/Confirm.aspx", true);
            routes.MapPageRoute("login", "Login", "~/Account/Login.aspx", true);
            routes.MapPageRoute("ShowPost", "Forums/Topic/{topicId}/Posts", "~/Managements/ForumPost/Default.aspx", true,
                null, new RouteValueDictionary { { "topicId", @"\d+" } });

            routes.MapPageRoute("ShowMsg", "User/Conversation/{id}/Messages", "~/Account/ShowMessages.aspx", true,
                new RouteValueDictionary { { "id", "" } }, new RouteValueDictionary { { "id", @"\d+" } });
            routes.MapPageRoute("EditForum", "Forum/Edit/{id}", "~/Managements/Forum/Edit.aspx", true, null,
                new RouteValueDictionary { { "id", @"\d+" } });
            routes.MapPageRoute("DeleteForum", "Forum/Delete/{id}", "~/Managements/Forum/Delete.aspx", true, null,
                new RouteValueDictionary { { "id", @"\d+" } });
            routes.MapPageRoute("InsertForum", "Forum/Insert", "~/Managements/Forum/Insert.aspx", true);

            routes.MapPageRoute("DeleteTopic", "Forums/{forumId}/Topics/Delete/{id}",
                "~/Managements/ForumTopic/Delete.aspx", true, null,
                new RouteValueDictionary { { "id", @"\d+" }, { "forumId", @"\d+" } });
            routes.MapPageRoute("EditTopic", "Forums/{forumId}/Topics/Edit/{id}/{fromPost}",
                "~/Managements/ForumTopic/Edit.aspx", true, new RouteValueDictionary { { "fromPost",0 } }, new RouteValueDictionary { { "id", @"\d+" }, { "forumId", @"\d+" }, { "fromPost", @"\d+" } });
            routes.MapPageRoute("CreateTopic", "Forums/{id}/Topics/NewTopic", "~/Managements/ForumTopic/Insert.aspx", true);

            routes.MapPageRoute("Profile", "Profile/{id}", "~/Account/PublicProfile.aspx", true, null, new RouteValueDictionary { { "id", @"\d+" } });
            routes.MapPageRoute("MainForum", "Forum", "~/Managements/Forum/Default.aspx", true);
            routes.MapPageRoute("SubForums", "Forums/{id}", "~/Managements/ForumTopic/Default.aspx", true, null, new RouteValueDictionary { { "id", @"\d+" } });
        }
开发者ID:rabbal,项目名称:AspNetWebForms-Forum,代码行数:56,代码来源:RouteConfig.cs

示例14: RegisterRoutes

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

            // Define uma rota padrão para qualquer controller e suas actions.
            routes.MapRoute("Controllers", "data/{controller}/{action}/");

            // Mapeia as rotas customizadas para tela default.
            routes.MapPageRoute("Default", "", "~/Views/Default.html");
        }
开发者ID:glhrmbhnrt,项目名称:DDD-Web-Application-Template,代码行数:10,代码来源:RouteConfig.cs

示例15: RegisterRoutes

 public static void RegisterRoutes(RouteCollection routes)
 {
     routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
     routes.Ignore("{rssname}.rss");
     routes.MapRoute(
         name: "Default",
         url: "{controller}/{action}/{id}",
         defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
     );
 }
开发者ID:ishwormali,项目名称:practices,代码行数:10,代码来源:RouteConfig.cs


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