Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="routes"></param>
        /// <param name="name"></param>
        /// <param name="protocol"></param>
        /// <param name="domain"></param>
        /// <param name="port"></param>
        /// <param name="url"></param>
        /// <param name="physicalFile"></param>
        /// <param name="checkPhysicalUrlAccess"></param>
        /// <param name="defaults"></param>
        /// <param name="constraints"></param>
        /// <param name="dataTokens"></param>
        /// <returns></returns>
        public static Route MapDomainPageRoute(this System.Web.Routing.RouteCollection routes, string name, string protocol, string domain, int port, string url, string physicalFile, bool checkPhysicalUrlAccess, object defaults, object constraints, object dataTokens)
        {
            if (routes == null)
            {
                throw new ArgumentNullException("routes");
            }
            if (domain == null)
            {
                throw new ArgumentNullException("domain");
            }
            if (url == null)
            {
                throw new ArgumentNullException("url");
            }
            Route route = new DomainRoute(domain, url, new PageRouteHandler(physicalFile, checkPhysicalUrlAccess))
            {
                Defaults    = RouteValueDictionaryHelper.CreateRouteValueDictionary(defaults),
                Constraints = RouteValueDictionaryHelper.CreateRouteValueDictionary(constraints),
                DataTokens  = RouteValueDictionaryHelper.CreateRouteValueDictionary(dataTokens),
                Protocol    = protocol,
                Port        = port,
            };

            routes.Add(name, route);
            return(route);
        }
 private void ga_UrlRoutingAdd(System.Web.Routing.RouteCollection routes, EventArgs e)
 {
     routes.Add(new Route("data/{FeedType}", new FeedRouteHandler()));
     routes.Add(new Route("data/{FeedType}/{CategoryName}/{Feed}", new FeedRouteHandler()));
     routes.Add(new Route("data/{FeedType}/{CategoryName}/{Feed}/default.aspx", new FeedRouteHandler()));
     routes.Add(new Route("download/{PostID}", new DownloadRouteHandler()));
 }
Beispiel #3
0
        internal static void Register(System.Web.Routing.RouteCollection routes)
        {
            routes.MapRoute("home", "", new { controller = "Home", action = "Index" });
            routes.MapRoute("login", "login", new { controller = "Account", action = "Login" });
            routes.MapRoute("logout", "logout", new { controller = "Account", action = "Logout" });
            routes.MapRoute("setup", "setup/step1", new { controller = "Setup", action = "step1" });
            routes.MapRoute("create-admin-account", "setup/create-admin-account", new { controller = "Setup", action = "CreateAdmin" });
            routes.MapRoute("create-api-key", "setup/create-api-key", new { controller = "Setup", action = "CreateAPIKey" });
            routes.MapRoute("update-schema", "setup/update-schema", new { controller = "Setup", action = "UpdateSchema" });
            routes.MapRoute("add-azure-subscription", "services/add-azure-subscription", new { controller = "Home", action = "AddAzureSubscription" });
            routes.MapRoute("add-azure-subscription-step-1", "services/add-azure-subscription/step1", new { controller = "Home", action = "AddAzureSubscriptionStep1" });
            routes.MapRoute("add-azure-subscription-step-2", "services/add-azure-subscription/step2", new { controller = "Home", action = "AddAzureSubscriptionStep2" });
            routes.MapRoute("add-azure-subscription-step-3", "services/add-azure-subscription/step3", new { controller = "Home", action = "AddAzureSubscriptionStep3" });
            routes.MapRoute("add-azure-subscription-step-4", "services/add-azure-subscription/step4", new { controller = "Home", action = "AddAzureSubscriptionStep4" });

            routes.MapRoute("add-azure-subscription-download-certificate", "services/add-azure-subscription/download-certificate", new { controller = "Home", action = "DownloadCertificate" });
            routes.MapRoute("api-settings", "api-settings", new { controller = "Home", action = "ApiSettings" });
            routes.MapRoute("test-api", "test-api", new { controller = "Home", action = "TestApi" });
            routes.MapRoute("logs", "logs", new { controller = "Home", action = "Logs" });

            routes.MapRoute("add-azure-sql-database", "services/add-azure-sql-database", new { controller = "Home", action = "AddAzureSQLDatabase" });
            routes.MapRoute("add-azure-sql-database-step-1", "services/add-azure-sql-database-step-1", new { controller = "Home", action = "AddAzureSQLDatabaseStep1" });
            routes.MapRoute("add-azure-sql-database-step-2", "services/add-azure-sql-database-step-2", new { controller = "Home", action = "AddAzureSQLDatabaseStep2" });
            routes.MapRoute("add-azure-sql-database-step-3", "services/add-azure-sql-database-step-3", new { controller = "Home", action = "AddAzureSQLDatabaseStep3" });

            routes.MapRoute("dashboard", "dashboard", new { controller = "Home", action = "Dashboard" });
            routes.MapRoute("dashboard-add-chart", "dashboard/add-chart", new { controller = "Home", action = "AddDashboardChart" });
            routes.MapRoute("dashboard-remove-chart", "dashboard/remove-chart", new { controller = "Home", action = "RemoveDashboardChart" });
            routes.MapRoute("dashboard-get-chart-info", "dashboard/get-chart-info", new { controller = "Home", action = "GetChartInfoById" });


            routes.MapRoute("ThankYouForCreatingAccount", "setup/thankyou", new { controller = "Setup", action = "ThankYou" });
        }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="routes"></param>
        /// <param name="name"></param>
        /// <param name="protocol"></param>
        /// <param name="domain"></param>
        /// <param name="port"></param>
        /// <param name="url"></param>
        /// <param name="defaults"></param>
        /// <param name="constraints"></param>
        /// <param name="namespaces"></param>
        /// <returns></returns>
        public static Route MapDomainRoute(this System.Web.Routing.RouteCollection routes, string name, string protocol, string domain, int port, string url, object defaults, object constraints, string[] namespaces)
        {
            if (routes == null)
            {
                throw new ArgumentNullException("routes");
            }
            if (domain == null)
            {
                throw new ArgumentNullException("domain");
            }
            if (url == null)
            {
                throw new ArgumentNullException("url");
            }
            Route route = new DomainRoute(domain, url, new MvcRouteHandler())
            {
                Defaults    = RouteValueDictionaryHelper.CreateRouteValueDictionary(defaults),
                Constraints = RouteValueDictionaryHelper.CreateRouteValueDictionary(constraints),
                DataTokens  = new RouteValueDictionary(),
                Protocol    = protocol,
                Port        = port,
            };

            if (namespaces.IsNotNullOrEmpty())
            {
                route.DataTokens["Namespaces"] = namespaces;
            }
            routes.Add(name, route);
            return(route);
        }
Beispiel #5
0
        public static void RegisterRoutes <T>(System.Web.Routing.RouteCollection routes, string routePrefix = "caldav", bool disallowMakeCalendar = false, bool requireAuthentication = false, string basicAuthenticationRealm = null)
            where T : CalDavController
        {
            var caldavControllerType = typeof(T);

            var namespaces = new[] { caldavControllerType.Namespace };
            var controller = caldavControllerType.Name;

            if (caldavControllerType.Name.EndsWith("Controller", StringComparison.OrdinalIgnoreCase))
            {
                controller = caldavControllerType.Name.Substring(0, caldavControllerType.Name.Length - "controller".Length);
            }

            var defaults = new { controller, action = "index" };

            MapFirst(routes, "CalDav Root", string.Empty, new { controller, action = "PropFind" }, namespaces, new { httpMethod = new Method("PROPFIND") });
            MapFirst(routes, "CalDav", BASE                    = routePrefix, defaults, namespaces);
            MapFirst(routes, "CalDav", BASE                    = routePrefix, defaults, namespaces);
            MapFirst(routes, "CalDav User", USER_ROUTE         = routePrefix + "/user/{id}/", defaults, namespaces);
            MapFirst(routes, "CalDav Calendar", CALENDAR_ROUTE = routePrefix + "/calendar/{id}/", defaults, namespaces);
            MapFirst(routes, "CalDav Object", OBJECT_ROUTE     = routePrefix + "/{uid}.ics", defaults, namespaces);
            MapFirst(routes, "CalDav Calendar Object", CALENDAR_OBJECT_ROUTE = routePrefix + "/calendar/{id}/{uid}.ics", defaults, namespaces);
            rxObjectRoute = new Regex(routePrefix + "(/calendar/(?<id>[^/]+))?/(?<uid>.+?).ics", RegexOptions.Compiled | RegexOptions.IgnoreCase);

            RequireAuthentication    = requireAuthentication;
            BasicAuthenticationRealm = basicAuthenticationRealm;
            DisallowMakeCalendar     = disallowMakeCalendar;
        }
Beispiel #6
0
        private static void MapSearchController(System.Web.Routing.RouteCollection routes)
        {
            System.Web.Mvc.RouteCollectionExtensions.MapRoute(routes, "SearchRoute", "search/{action}/{*scItemPath}",
                                                              new
            {
                controller     = "Search",
                scKeysToIgnore = new string[] { }
            },
                                                              new
            {
            }
                                                              );
            System.Web.Mvc.RouteCollectionExtensions.MapRoute(routes, "Test", "test/{action}/{*scItemPath}",
                                                              new
            {
                controller     = "Test",
                scKeysToIgnore = new string[] { }
            },
                                                              new
            {
            }
                                                              );
            System.Web.Mvc.RouteCollectionExtensions.MapRoute(routes, "Mobile", "-/mobile/{controller}/{action}/",
                                                              new
            {
                scKeysToIgnore = new string[] { }
            },
                                                              new
            {
            }
                                                              );
            System.Web.Mvc.RouteCollectionExtensions.MapRoute(routes, "Experience", "-/experience/{action}/{identifier}/{*scItemPath}",
                                                              new
            {
                controller     = "Experience",
                scItemPath     = "Profile/ExperienceAction",
                scKeysToIgnore = new string[] { }
            },
                                                              new
            {
            }
                                                              );


            GlobalConfiguration.Configuration.Routes.MapHttpRoute("ExperienceApi", "-/expapi/{action}/{identifier}",
                                                                  new {
                controller = "ExperienceApi",
                identifier = RouteParameter.Optional
            });

            GlobalConfiguration.Configuration.Routes.MapHttpRoute("Report", "-/report/{action}",
                                                                  new
            {
                controller = "Report"
            });
        }
        public void add_namespaces_for_controller()
        {
            var routes = new System.Web.Routing.RouteCollection();

            routes.MapNavigationRoute<HomeController>("Home", c => c.Index());

            routes.Count().ShouldEqual(1);
            var namespaces = (string[]) ((NamedRoute) routes["Navigation-Home-Index"]).DataTokens["Namespaces"];
            namespaces.ShouldContain("UnitTests");
        }
        public static void RegisterRoute(System.Web.Routing.RouteCollection routes)
        {
            //routes.MapPageRoute("ForTitle", "~/{Name}", "~/default.aspx");
            //routes.MapPageRoute("ForTitle", "~/{Name}", "~/");

            routes.MapPageRoute("baslik", "/{title}", "~/default.aspx", false);
            routes.MapPageRoute("yazar", "yazar/{name}", "~/user/yazar.aspx", false);
            routes.MapPageRoute("entry", "entry/{number}", "~/entry/entry.aspx", false);
            routes.MapPageRoute("oda", "oda/{dep}", "~/department/oda.aspx", false);
        }
        public void should_contain_child_routes()
        {
            var routes = new System.Web.Routing.RouteCollection();
            routes.MapNavigationRoute<HomeController>("Home", c => c.Index())
            .AddChildRoute<HomeController>("Logout", c => c.Logout())
            .AddChildRoute<HomeController>("Foobar", c => c.ChangePassword());

            routes.Count().ShouldEqual(3);
            ((NamedRoute)routes["Navigation-Home-Index"]).Children.Count().ShouldEqual(2);
        }
        public void add_filter_tokens()
        {
            var filterTokenText = "foo";
            var routes = new System.Web.Routing.RouteCollection();
            routes.MapNavigationRoute<HomeController>("Home", c => c.Index(), "", new NavigationRouteOptions { FilterToken = filterTokenText });

            Assert.IsTrue(((NamedRoute)routes["Navigation-Home-Index"]).DataTokens.HasFilterToken());

            var filterToken = (string)((NamedRoute)routes["Navigation-Home-Index"]).DataTokens.FilterToken();
            filterToken.ShouldEqual(filterTokenText);
        }
Beispiel #11
0
        public void should_contain_child_routes()
        {
            var routes = new System.Web.Routing.RouteCollection();

            routes.MapNavigationRoute <HomeController>("Home", c => c.Index())
            .AddChildRoute <HomeController>("Logout", c => c.Logout())
            .AddChildRoute <HomeController>("Foobar", c => c.ChangePassword());

            routes.Count().ShouldEqual(3);
            ((NamedRoute)routes["Navigation-Home-Index"]).Children.Count().ShouldEqual(2);
        }
Beispiel #12
0
        public override void AddRoutesTo(System.Web.Routing.RouteCollection routeCollection)
        {
            var routes = new RouteCollection();

            new TArea().RegisterRoutes(routes);
            foreach (var route in routes.Select(x => (Route)x))
            {
                route.Url = pathPrefix + route.Url;
                routeCollection.Add(route);
            }
        }
Beispiel #13
0
        private static void MapFirst(System.Web.Routing.RouteCollection routes, string name, string path, object defaults, string[] namespaces, object constraints = null)
        {
            var route = routes.MapRoute(name, path, defaults);

            if (constraints != null)
            {
                route.Constraints = new System.Web.Routing.RouteValueDictionary(constraints);
            }
            routes.Remove(route);
            routes.Insert(0, route);
        }
Beispiel #14
0
        public void add_namespaces_for_controller()
        {
            var routes = new System.Web.Routing.RouteCollection();

            routes.MapNavigationRoute <HomeController>("Home", c => c.Index());

            routes.Count().ShouldEqual(1);
            var namespaces = (string[])((NamedRoute)routes["Navigation-Home-Index"]).DataTokens["Namespaces"];

            namespaces.ShouldContain("UnitTests");
        }
        public void add_namespaces()
        {
            var routes = new System.Web.Routing.RouteCollection();
            routes.MapNavigationRoute("Home-navigation", "Home", "",
                                        defaults: new { controller = "Home", action = "Index" },
                                        namespaces: new[] { "UnitTests" });
            routes.Count().ShouldEqual(1);

            var namespaces = (string[]) ((NamedRoute) routes["Home-navigation"]).DataTokens["Namespaces"];
            namespaces.ShouldContain("UnitTests");
        }
Beispiel #16
0
        public void Map_a_route_to_a_url_matching_the_action_name()
        {
            var routes = new System.Web.Routing.RouteCollection();

            routes.MapNavigationRoute <HomeController>("Home", c => c.Index());
            routes.MapNavigationRoute <HomeController>("About", c => c.About());

            routes.Count.ShouldNotEqual(0);

            var uh = GetUrlHelper(routes);

            uh.RouteUrl("Navigation-Home-About").ShouldEqual("/about");
        }
Beispiel #17
0
        public void add_namespaces()
        {
            var routes = new System.Web.Routing.RouteCollection();

            routes.MapNavigationRoute("Home-navigation", "Home", "",
                                      defaults: new { controller = "Home", action = "Index" },
                                      namespaces: new[] { "UnitTests" });
            routes.Count().ShouldEqual(1);

            var namespaces = (string[])((NamedRoute)routes["Home-navigation"]).DataTokens["Namespaces"];

            namespaces.ShouldContain("UnitTests");
        }
 private static void MapSearchController(System.Web.Routing.RouteCollection routes)
 {
     System.Web.Mvc.RouteCollectionExtensions.MapRoute(routes, "SearchRoute", "search/{action}/{*scItemPath}",
                                                       new
     {
         controller     = "Search",
         scKeysToIgnore = new string[] { }
     },
                                                       new
     {
     }
                                                       );
 }
        public void Map_home_index_to_the_site_root()
        {
            var routes = new System.Web.Routing.RouteCollection();

            routes.MapNavigationRoute<HomeController>("Home", c => c.Index());
            routes.MapNavigationRoute<HomeController>("About", c => c.About());
            routes.MapNavigationRoute<HomeController>("Logout", c => c.Logout());

            routes.Count.ShouldNotEqual(0);

            var uh = GetUrlHelper(routes);
            uh.RouteUrl("Navigation-Home-Index").ShouldEqual("/");
        }
        public void should_apply_filters()
        {
            
            var filters = new List<INavigationRouteFilter>();
            filters.Add(new RemoveAuthorizeActions());
            
            var routes = new System.Web.Routing.RouteCollection();
            routes.MapNavigationRoute<HomeController>("Home", c => c.Index());
            routes.MapNavigationRoute<HomeController>("Logout", c => c.Logout());

            var currentRoutes = NavigationRoutes.NavigationViewExtensions.GetRoutesForCurrentRequest(routes, filters);
            currentRoutes.Count().ShouldEqual(1);
        }
        public void Map_a_route_to_a_url_matching_the_action_name()
        {
            var routes = new System.Web.Routing.RouteCollection();

            routes.MapNavigationRoute<HomeController>("Home", c => c.Index());
            routes.MapNavigationRoute<HomeController>("About", c => c.About());

            routes.Count.ShouldNotEqual(0);

            var uh = GetUrlHelper(routes);

            uh.RouteUrl("Navigation-Home-About").ShouldEqual("/about"); 
        }
Beispiel #22
0
        public void Map_home_index_to_the_site_root()
        {
            var routes = new System.Web.Routing.RouteCollection();

            routes.MapNavigationRoute <HomeController>("Home", c => c.Index());
            routes.MapNavigationRoute <HomeController>("About", c => c.About());
            routes.MapNavigationRoute <HomeController>("Logout", c => c.Logout());

            routes.Count.ShouldNotEqual(0);

            var uh = GetUrlHelper(routes);

            uh.RouteUrl("Navigation-Home-Index").ShouldEqual("/");
        }
Beispiel #23
0
        public void add_filter_tokens()
        {
            var filterTokenText = "foo";
            var routes          = new System.Web.Routing.RouteCollection();

            routes.MapNavigationRoute <HomeController>("Home", c => c.Index(), "", new NavigationRouteOptions {
                FilterToken = filterTokenText
            });

            Assert.IsTrue(((NamedRoute)routes["Navigation-Home-Index"]).DataTokens.HasFilterToken());

            var filterToken = (string)((NamedRoute)routes["Navigation-Home-Index"]).DataTokens.FilterToken();

            filterToken.ShouldEqual(filterTokenText);
        }
Beispiel #24
0
        public void should_apply_filters()
        {
            var filters = new List <INavigationRouteFilter>();

            filters.Add(new RemoveAuthorizeActions());

            var routes = new System.Web.Routing.RouteCollection();

            routes.MapNavigationRoute <HomeController>("Home", c => c.Index());
            routes.MapNavigationRoute <HomeController>("Logout", c => c.Logout());

            var currentRoutes = NavigationRoutes.NavigationViewExtensions.GetRoutesForCurrentRequest(routes, filters);

            currentRoutes.Count().ShouldEqual(1);
        }
        public RouteCollection GetRoutes()
        {
            var rc = new RouteCollection();
            var cfg = MiniMvcSystem.Config;

            foreach (RouteElement route in cfg.Routes)
            {
                var rd = new RouteValueDictionary {
                            {"controller", route.Controller}, {"action", route.Action}
                        };

                rc.Add(route.Name, new Route(route.Url, rd, MiniMvcSystem.GetRouteHandler()));
            }

            return rc;
        }
Beispiel #26
0
        public RouteCollection GetRoutes()
        {
            var rc  = new RouteCollection();
            var cfg = MiniMvcSystem.Config;

            foreach (RouteElement route in cfg.Routes)
            {
                var rd = new RouteValueDictionary {
                    { "controller", route.Controller }, { "action", route.Action }
                };

                rc.Add(route.Name, new Route(route.Url, rd, MiniMvcSystem.GetRouteHandler()));
            }

            return(rc);
        }
        public void Map_a_route_to_a_url_using_an_area()
        {
            var routes = new System.Web.Routing.RouteCollection();

            routes.MapNavigationRoute<HomeController>("Home", c => c.Index(),"Admin");
            routes.MapNavigationRoute<HomeController>("About", c => c.About(),"AdMin");

            routes.Count.ShouldNotEqual(0);

            var uh = GetUrlHelper(routes);

            uh.RouteUrl("Navigation-Admin-Home-About").ShouldEqual("/admin/about");
            var r = (Route)routes["Navigation-Admin-Home-About"];
            r.DataTokens["area"].ToString().ShouldEqual("admin");
            
            uh.RouteUrl("Navigation-AdMin-Home-Index").ShouldEqual("/admin");
        }
Beispiel #28
0
        public static void MapRoute(
            this System.Web.Routing.RouteCollection routes,
            MvcRouteConfigurationSection section)
        {
            // Manipulate the Ignore List
            foreach (IgnoreItem ignoreItem in section.Ignore)
            {
                RouteValueDictionary ignoreConstraints = new RouteValueDictionary();

                foreach (Constraint constraint in ignoreItem.Constraints)
                {
                    ignoreConstraints.Add(constraint.Name, constraint.Value);
                }

                IgnoreRoute(routes, ignoreItem.Url, ignoreConstraints);
            }

            // Manipluate the Routing Table
            foreach (RoutingItem routingItem in section.Map)
            {
                RouteValueDictionary defaults    = new RouteValueDictionary();
                RouteValueDictionary constraints = new RouteValueDictionary();

                if (routingItem.Controller != string.Empty)
                {
                    defaults.Add("controller", routingItem.Controller);
                }

                if (routingItem.Action != string.Empty)
                {
                    defaults.Add("action", routingItem.Action);
                }

                foreach (Parameter param in routingItem.Paramaters)
                {
                    defaults.Add(param.Name, param.Value);
                    if (!string.IsNullOrEmpty(param.Constraint))
                    {
                        constraints.Add(param.Name, param.Constraint);
                    }
                }

                MapRoute(routes, routingItem.Name, routingItem.Url, defaults, constraints);
            }
        }
Beispiel #29
0
        public static void Register(R.RouteCollection routes)
        {
            routes.MapHttpRoute(
                name: "ControllerActionObj0",
                routeTemplate: "api/Project/{controller}/{action}/{obj}",
                defaults: new { obj = RouteParameter.Optional }
                );

            routes.MapHttpRoute(
                name: "ControllerObj1",
                routeTemplate: "api/Project/{controller}/{obj}",
                defaults: new { obj = RouteParameter.Optional }
                );

            routes.MapHttpRoute(
                name: "ControllerActionObj",
                routeTemplate: "api/{controller}/{action}/{obj}",
                defaults: new { obj = RouteParameter.Optional }
                );

            routes.MapHttpRoute(
                name: "ControllerObj",
                routeTemplate: "api/{controller}/{obj}",
                defaults: new { obj = RouteParameter.Optional }
                );



            routes.Ignore("Images/{pathInfo}.svg");
            routes.Ignore("Images/{pathInfo}.png");
            routes.Ignore("Images/{pathInfo}.jpg");
            routes.Ignore("Views/{pathInfo}");
            routes.Ignore("Views/{pathInfo}/{Param1}");
            routes.Ignore("Views/{pathInfo}/{Param1}/{Param2}");
            routes.Ignore("Views/{pathInfo}/{Param1}/{Param2}/{Param3}");

            routes.MapPageRoute("Main", "", "~/Default.aspx");
            routes.MapPageRoute("Page", "{Page}", "~/Default.aspx");
            routes.MapPageRoute("SubPages", "{Page}/{SubPage}", "~/Default.aspx");
            routes.MapPageRoute("TertPages", "{Page}/{SubPage}/{TertPage}", "~/Default.aspx");
            routes.MapPageRoute("QuatPages", "{Page}/{SubPage}/{TertPage}/{QuatPages}", "~/Default.aspx");
            routes.MapPageRoute("QuinPages", "{Page}/{SubPage}/{TertPage}/{QuatPages}/{QuinPages}", "~/Default.aspx");
            routes.MapPageRoute("SexPages", "{Page}/{SubPage}/{TertPage}/{QuatPages}/{QuinPages}/{SexPages}", "~/Default.aspx");
        }
Beispiel #30
0
//-------------------------------------------------------------------------------------------
    public static void RegisterDynamicDataRoutes(System.Web.Routing.RouteCollection routes)
    {
        DefaultModel.FieldTemplateFactory = new SecureFieldTemplateFactory();
        ContextConfiguration config = new ContextConfiguration()
        {
            ScaffoldAllTables = true
        };

        DefaultModel.RegisterContext(typeof(Weavver.Data.WeavverEntityContainer), config);
        DefaultModel.RegisterContext(typeof(Weavver.Workflows.WorkflowContainer), config);

        // separate page mode
        routes.Add(new DynamicDataRoute("{table}/{action}.aspx")
        {
            Constraints  = new System.Web.Routing.RouteValueDictionary(new { action = "BlogRoll|PressRoll|StoreItem|Showcase|Page|XML|List|Details|Insert|ListDetails|CSV|Edit" }),
            RouteHandler = new SecureDynamicDataRouteHandler(),
            Model        = DefaultModel
        });

        //routes.Add(new DynamicDataRoute("{table}/{action}.aspx")
        //{
        //     Constraints = new System.Web.Routing.RouteValueDictionary(new { action =  }),
        //     RouteHandler = new DynamicDataRouteHandler(),
        //     Model = DefaultModel
        //});

        // combined page mode
        routes.Add(new DynamicDataRoute("{table}/KnowledgeBase.aspx")
        {
            Action       = PageAction.List,
            RouteHandler = new DynamicDataRouteHandler(),
            ViewName     = "KnowledgeBase",
            Model        = DefaultModel
        });

        //routes.Add(new DynamicDataRoute("{table}/ListDetails.aspx")
        //{
        //     Action = PageAction.List,
        //     RouteHandler = new SecureDynamicDataRouteHandler(),
        //     ViewName = "ListDetails",
        //     Model = DefaultModel
        //});
    }
Beispiel #31
0
 static void RegisterRoutes(System.Web.Routing.RouteCollection routes)
 {
     routes.MapPageRoute("index", "index", "~/index.aspx");
     routes.MapPageRoute("mainindex", "main/index", "~/main/index.aspx");
     routes.MapPageRoute("allUsers", "main/allUsers", "~/main/allUsers.aspx");
     routes.MapPageRoute("InfoLinks", "main/InfoLinks", "~/main/InfoLinks.aspx");
     routes.MapPageRoute("categoriesPage", "main/categoriesPage", "~/main/categoriesPage.aspx");
     routes.MapPageRoute("myOffers", "main/myOffers", "~/main/myOffers.aspx");
     routes.MapPageRoute("myRequests", "main/myRequests", "~/main/myRequests.aspx");
     routes.MapPageRoute("offerHelp", "main/offerHelp", "~/main/offerHelp.aspx");
     routes.MapPageRoute("requestHelp", "main/requestHelp", "~/main/requestHelp.aspx");
     routes.MapPageRoute("subCategoriesPage", "main/subCategoriesPage", "~/main/subCategoriesPage.aspx");
     routes.MapPageRoute("userProfile", "main/userProfile", "~/main/userProfile.aspx");
     routes.MapPageRoute("manageLanguage", "main/manageLanguage", "~/main/manageLanguage.aspx");
     routes.MapPageRoute("reportsMonitor", "main/reportsMonitor", "~/main/reportsMonitor.aspx");
     routes.MapPageRoute("smsConfiguration", "main/smsConfiguration", "~/main/smsConfiguration.aspx");
     routes.MapPageRoute("ConfigUnits", "main/ConfigUnits", "~/main/ConfigUnits.aspx");
     routes.MapPageRoute("adminDash", "main/adminDash", "~/main/adminDash.aspx");
     routes.MapPageRoute("adminDetailed", "main/adminDetailed", "~/main/adminDetailed.aspx");
 }
Beispiel #32
0
        public void RegisterRoutes(RouteCollection routes)
        {
            RouteSection routesTableSection = GetRouteTableConfigurationSection();

            if (routesTableSection == null || routesTableSection.Routes.Count <= 0)
                return;

            for (int routeIndex = 0; routeIndex < routesTableSection.Routes.Count; routeIndex++)
            {
                var routeElement = routesTableSection.Routes[routeIndex];

                var route = new Route(
                    routeElement.Url,
                    GetDefaults(routeElement),
                    GetConstraints(routeElement),
                    GetDataTokens(routeElement),
                    GetInstanceOfRouteHandler(routeElement));

                routes.Add(routeElement.Name, route);
            }
        }
Beispiel #33
0
        public void Map_a_route_to_a_url_using_an_area()
        {
            var routes = new System.Web.Routing.RouteCollection();

            routes.MapNavigationRoute <HomeController>("Home", c => c.Index(), "", new NavigationRouteOptions {
                AreaName = "Admin"
            });
            routes.MapNavigationRoute <HomeController>("About", c => c.About(), "", new NavigationRouteOptions {
                AreaName = "AdMin"
            });

            routes.Count.ShouldNotEqual(0);

            var uh = GetUrlHelper(routes);

            uh.RouteUrl("Navigation-Admin-Home-About").ShouldEqual("/admin/about");
            var r = (Route)routes["Navigation-Admin-Home-About"];

            r.DataTokens["area"].ToString().ShouldEqual("admin");

            uh.RouteUrl("Navigation-AdMin-Home-Index").ShouldEqual("/admin");
        }
Beispiel #34
0
        /// <summary>
        /// Registers from configuration route table.
        /// </summary>
        /// <param name="routes">The routes.</param>
        public static void RegisterFromConfigRouteTable(System.Web.Routing.RouteCollection routes)
        {
            var routesTableSection = Configuration.GetRouteTable();

            if (routesTableSection != null && routesTableSection.Routes.Count > 0)
            {
                for (var routeIndex = 0; routeIndex < routesTableSection.Routes.Count; routeIndex++)
                {
                    var route = routesTableSection.Routes[routeIndex];

                    routes.Add(
                        route.Name,
                        new Route(
                            route.Url,
                            GetDefaults(route),
                            GetConstraints(route),
                            GetDataTokens(route),
                            GetInstanceOfRouteHandler(route)
                            ));
                }
            }
        }
Beispiel #35
0
        public static void RegisterConfigurationBundles(this RouteCollection routes)
        {
            RouteConfigurationSection routesTableSection = GetRouteTableConfigurationSection();

            if (routesTableSection == null || routesTableSection.Routes.Count <= 0)
            {
                return;
            }

            for (int routeIndex = 0; routeIndex < routesTableSection.Routes.Count; routeIndex++)
            {
                var routeElement = routesTableSection.Routes[routeIndex];

                var route = new Route(
                    routeElement.Url,
                    GetDefaults(routeElement),
                    GetConstraints(routeElement),
                    GetDataTokens(routeElement),
                    GetInstanceOfRouteHandler(routeElement));

                routes.Add(routeElement.Name, route);
            }
        }
Beispiel #36
0
 /// <summary>
 /// 注册路由
 /// </summary>
 /// <param name="routes">RouteCollection</param>
 public static void RegisterPageRoutes(System.Web.Routing.RouteCollection routes)
 {
     foreach (FileRouteElement route in YuYuWebConfigurationSectionGroup.YuYuFileRouteCollectionConfigurationSection.Routes.RouteElements)
     {
         RouteValueDictionary defaults    = RouteValueDictionaryHelper.CreateRouteValueDictionary(route.Defaults.CreateObject());
         RouteValueDictionary constraints = RouteValueDictionaryHelper.CreateRouteValueDictionary(route.Constraints.CreateObject());
         if (string.IsNullOrWhiteSpace(route.Domain))
         {
             routes.Add(route.Name, new Route(route.Url, defaults, constraints, route.RouteHandler ?? YuYuWebConfigurationSectionGroup.YuYuFileRouteCollectionConfigurationSection.CreateDefaultRouteHandler(route.PhysicalFile, route.CheckPhysicalUrlAccess)));
         }
         else
         {
             routes.Add(route.Name, new DomainRoute(route.Domain, route.Url, route.RouteHandler ?? YuYuWebConfigurationSectionGroup.YuYuFileRouteCollectionConfigurationSection.CreateDefaultRouteHandler(route.PhysicalFile, route.CheckPhysicalUrlAccess))
             {
                 Defaults    = defaults,
                 Constraints = constraints,
                 DataTokens  = new RouteValueDictionary(),
                 Port        = route.Port,
                 Protocol    = route.Protocol,
             });
         }
     }
 }
Beispiel #37
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="routes"></param>
 /// <param name="name"></param>
 /// <param name="protocol"></param>
 /// <param name="domain"></param>
 /// <param name="port"></param>
 /// <param name="url"></param>
 /// <param name="defaults"></param>
 /// <returns></returns>
 public static Route MapDomainRoute(this System.Web.Routing.RouteCollection routes, string name, string protocol, string domain, int port, string url, object defaults = null)
 {
     return(routes.MapDomainRoute(name, protocol, domain, port, url, defaults, null, null));
 }
Beispiel #38
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="routes"></param>
 /// <param name="name"></param>
 /// <param name="protocol"></param>
 /// <param name="domain"></param>
 /// <param name="url"></param>
 /// <param name="namespaces"></param>
 /// <returns></returns>
 public static Route MapDomainRoute(this System.Web.Routing.RouteCollection routes, string name, string protocol, string domain, string url, string[] namespaces)
 {
     return(routes.MapDomainRoute(name, protocol, domain, url, null, null, namespaces));
 }
        public void RegisterRoutes(System.Web.Routing.RouteCollection routes)
        {
            System.Web.Mvc.ViewEngines.Engines.Add(new ExtendedVendorViewEngine());


            routes.MapRoute("ExtendedVendorEditVendor",
                            "extendedvendor/vendor/edit/{Id}",
                            new { controller = "ExtendedVendor", action = "EditVendor", Id = 0 },
                            new[] { "RoastedBytes.Nop.Plugin.Misc.ExtendedVendor.Controllers" }).DataTokens.Add("area", "Admin");

            routes.MapRoute("ExtendedVendorSaveVendor",
                            "extendedvendor/vendor/save",
                            new { controller = "ExtendedVendor", action = "SaveVendor" },
                            new[] { "RoastedBytes.Nop.Plugin.Misc.ExtendedVendor.Controllers" }).DataTokens.Add("area", "Admin");

            routes.MapRoute("ExtendedVendorEditReview",
                            "extendedvendor/vendor/review/edit/{Id}",
                            new { controller = "ExtendedVendor", action = "EditReview", Id = 0 },
                            new[] { "RoastedBytes.Nop.Plugin.Misc.ExtendedVendor.Controllers" }).DataTokens.Add("area", "Admin");



            routes.MapRoute("ExtendedVendorListReviewsAdmin",
                            "extendedvendor/vendor/review/list/{VendorId}",
                            new { controller = "ExtendedVendor", action = "ListReviewsAdmin", VendorId = 0 },
                            new[] { "RoastedBytes.Nop.Plugin.Misc.ExtendedVendor.Controllers" }).DataTokens.Add("area", "Admin");

            routes.MapRoute("ExtendedVendorDetails",
                            "vendor-details/{SeName}",
                            new { controller = "ExtendedVendor", action = "ExtendedVendorDetails" },
                            new[] { "RoastedBytes.Nop.Plugin.Misc.ExtendedVendor.Controllers" });

            routes.MapRoute("ExtendedVendorListPayoutsAdmin",
                            "extendedvendor/vendor/payout/list/{VendorId}",
                            new { controller = "ExtendedVendor", action = "ListPayoutsAdmin", VendorId = 0 },
                            new[] { "RoastedBytes.Nop.Plugin.Misc.ExtendedVendor.Controllers" }).DataTokens.Add("area", "Admin");

            routes.MapRoute("ExtendedVendorEditPayout",
                            "extendedvendor/vendor/payout/edit/{Id}",
                            new { controller = "ExtendedVendor", action = "EditPayout", Id = 0 },
                            new[] { "RoastedBytes.Nop.Plugin.Misc.ExtendedVendor.Controllers" }).DataTokens.Add("area", "Admin");

            routes.MapRoute("ExtendedVendorSavePayout",
                            "extendedvendor/vendor/payout/save",
                            new { controller = "ExtendedVendor", action = "SavePayout" },
                            new[] { "RoastedBytes.Nop.Plugin.Misc.ExtendedVendor.Controllers" }).DataTokens.Add("area", "Admin");

            routes.MapRoute("ExtendedVendorEditReviewPublic",
                            "edit-extended-review/{OrderId}/{ProductId}",
                            new
            {
                controller = "ExtendedVendor",
                action     = "EditExtendedReview",
            },
                            new[] { "RoastedBytes.Nop.Plugin.Misc.ExtendedVendor.Controllers" });

            routes.MapRoute("ExtendedVendorReviewCenterLoader",
                            "customer/review-center",
                            new
            {
                controller = "ExtendedVendor",
                action     = "UserReviews",
            },
                            new[] { "RoastedBytes.Nop.Plugin.Misc.ExtendedVendor.Controllers" });

            routes.MapRoute("ExtendedVendorReviewCenter",
                            "account/review-center/{Type}",
                            new
            {
                controller = "ExtendedVendor",
                action     = "UserReviewsData",
                Type       = "product",
            },
                            new[] { "RoastedBytes.Nop.Plugin.Misc.ExtendedVendor.Controllers" });
        }
 public void Dispose()
 {
     this.ControlBuilder = null;
     if (this.OwnerControl != null)
     {
         this.OwnerControl.Dispose();
     }
     this.ControlDesignerAccessorUserData = null;
     this.DesignModeState = null;
     this.RenderingCompatibility = null;
     this.RouteCollection = null;
 }
Beispiel #41
0
 public static void RegisterRoutes(System.Web.Routing.RouteCollection routes, string routePrefix = "caldav", bool disallowMakeCalendar = false, bool requireAuthentication = false, string basicAuthenticationRealm = null)
 {
     RegisterRoutes <CalDavController>(routes, routePrefix, disallowMakeCalendar, requireAuthentication, basicAuthenticationRealm);
 }