Exemplo n.º 1
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd

            routes.MapAttributeRoutes();
        }
Exemplo n.º 2
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            // Note: All routes should be handled by the RouteAttribute on each action
            routes.MapAttributeRoutes(config => config.AddRoutesFromAssemblyOf<RouteConfig>());
        }
        public static void RegisterRoutes(RouteCollection routes)
        {
            // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd

            routes.MapAttributeRoutes();
        }
        public void Setup()
        {
            assertEngine = new FakeAssertEngine();
            RouteAssert.UseAssertEngine(assertEngine);

            routes = new RouteCollection();
            routes.MapAttributeRoutes(c => c.AddRoutesFromController<HomeAttrController>());
        }
Exemplo n.º 5
0
 public static void RegisterRoutes(RouteCollection routes)
 {
     routes.MapAttributeRoutes(config =>
     {
         config.AddRoutesFromAssemblyOf <HomeController>();
         config.AppendTrailingSlash = true;
         config.UseLowercaseRoutes  = true;
     });
 }
Exemplo n.º 6
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd
            routes.MapAttributeRoutes();

            routes.MapHttpAttributeRoutes();
        }
Exemplo n.º 7
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
            routes.MapAttributeRoutes();
        }
Exemplo n.º 8
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd

            routes.MapAttributeRoutes(config =>
            {
                config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
                config.AutoGenerateRouteNames = true;
            });
        }
Exemplo n.º 9
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapAttributeRoutes(config =>
            {
                config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
                config.UseLowercaseRoutes = true;
                config.PreserveCaseForUrlParameters = true;
            });
        }
		public static void RegisterRoutes(RouteCollection routes) 
		{    
			// See http://github.com/mccalltd/AttributeRouting/wiki for more options.
			// To debug routes locally using the built in ASP.NET development server, go to /routes.axd
            
			routes.MapAttributeRoutes(config =>
			{
				config.UseLowercaseRoutes = true;
				config.PreserveCaseForUrlParameters = true;
			});
		}
Exemplo n.º 11
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd

            routes.MapAttributeRoutes(config =>
            {
                config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
                config.UseLowercaseRoutes = true;
            });
        }
Exemplo n.º 12
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd

            routes.MapAttributeRoutes(config =>
            {
                config.UseLowercaseRoutes           = true;
                config.PreserveCaseForUrlParameters = true;
            });
        }
Exemplo n.º 13
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapAttributeRoutes(config =>
            {
                config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
                config.UseLowercaseRoutes           = true;
                config.PreserveCaseForUrlParameters = true;
            });
        }
Exemplo n.º 14
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapAttributeRoutes();

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
                );
        }
Exemplo n.º 15
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapAttributeRoutes();

            routes.MapRoute(
                "CatchAllRoute",
                "{*url}",
                new { controller = "Error", action = "CatchAll" }
            );
        }
        public static void RegisterRoutes(RouteCollection routes)
        {
            // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd

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

            routes.MapAttributeRoutes(config =>
            {
                config.ScanAssembly(Assembly.GetExecutingAssembly());
                config.UseLowercaseRoutes = true;
            });
        }
Exemplo n.º 17
0
        private static void RegisterAttributeRoutes(RouteCollection routes)
        {
            // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd

            routes.MapAttributeRoutes(config =>
            {
                config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
                config.AddRoutesFromAssemblyOf<SearchLayer>();
                //config.AddRoutesFromAssemblyOf<YourCustomLayer>();
                config.UseLowercaseRoutes = true;
            });
        }
Exemplo n.º 18
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapAttributeRoutes(config=>
            {
                config.ScanAssemblyOf<MvcApplication>();
                config.UseLowercaseRoutes = true;
                config.AppendTrailingSlash = true;
            });

            routes.MapRoute("CatchAll", "{*path}", new { controller = "Error", action = "FileNotFound" });
        }
Exemplo n.º 19
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            //
            routes.IgnoreRoute("elmah.axd");
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
            //Skip static files
            routes.IgnoreRoute("{*staticfile}", new { staticfile = @".*\.(jpg|gif|jpeg|png|css|js)$" });

            // See http://github.com/mccalltd/AttributeRouting/wiki/3.-Configuration for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd
            routes.MapAttributeRoutes(config =>
            {
                config.ScanAssembly(Assembly.GetExecutingAssembly());
                config.AutoGenerateRouteNames = true; //Essential for duplicate actions with GET and POST or same action with both GET POST
                //IMPORTANT: don't use the following or else it will do redirects and remove port number which won't work with AppHarbor
                config.UseLowercaseRoutes = false;
                config.AddDefaultRouteConstraint(@"^id$", new RegexRouteConstraint(@"^\d+$"));
            });

            //
            //                                   DON'T   DELETE   THE     FOLLOWING
            //
            //This is essential for:
            // -Letting domain.com open default action
            // -When generating urls with T4MVC for actions that contain parameters but we expect the path to be empty
            //  Example:
            //      For MyController.GetUpdates(long id), Url.Action(MVC.My.GetUpdates()) will result in an empty string instead of "/my/getupdates"
            //      It doesnt matter if the controller is decorated with [GET("GetUpdates/{id}")] or [POST("GetUpdates/{id}")]

            //routes.MapRoute(
            //    "Default_app", // Route name
            //    "App/{pageid}/{controller}/{action}/{id}", // URL with parameters
            //   new { pageid = "0", controller = "Home", action = "index", id = UrlParameter.Optional },
            //   new string[] {"SocialFruits.Controllers"} // Parameter defaults
            //);

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

            ////Catch reamining routes
            //routes.MapRoute("catch-all", "{*catchall}", MVC.Error.NotFound(),
            //    new string[] { "SocialFruits.Controllers" }
            //    );
        }
Exemplo n.º 20
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapAttributeRoutes(config =>
            {
                config.ScanAssemblyOf<ControllerBase>();
                config.AddDefaultRouteConstraint(@"[Ii]d$", new RegexRouteConstraint(@"^\d+$"));
            });

            routes.MapRoute("CatchAll",
                            "{*path}",
                            new { controller = "home", action = "filenotfound" },
                            new[] { typeof(HomeController).Namespace });
        }
Exemplo n.º 21
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapAttributeRoutes(config =>
            {
                config.ScanAssemblyOf <ControllerBase>();
                config.AddDefaultRouteConstraint(@"[Ii]d$", new RegexRouteConstraint(@"^\d+$"));
            });

            routes.MapRoute("CatchAll",
                            "{*path}",
                            new { controller = "home", action = "filenotfound" },
                            new[] { typeof(HomeController).Namespace });
        }
Exemplo n.º 22
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd

            routes.MapAttributeRoutes(
                config =>
            {
                config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
                config.AddRoutesFromControllersOfType <Controller>();
                //config.UseLowercaseRoutes = true;
                config.DefaultSubdomain = "admin";
                config.MapArea("Admin").ToSubdomain("admin");
            }
                );
        }
        public static void RegisterRoutes(RouteCollection routes)
        {
            // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd

            routes.MapAttributeRoutes(
                config =>
                {
                    config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
                    config.AddRoutesFromControllersOfType<Controller>();
                    //config.UseLowercaseRoutes = true;
                    config.DefaultSubdomain = "admin";
                    config.MapArea("Admin").ToSubdomain("admin");
                }
            );
        }
Exemplo n.º 24
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Account", action = "Login", id = UrlParameter.Optional }
                );

            routes.MapRoute(
                name: "Api",
                url: "rest/{action}",
                namespaces: new[] { "HeadSpring.Web.Controllers" });

            routes.MapAttributeRoutes();
        }
 public static void RegisterRoutes(RouteCollection routes)
 {
     // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
     // To debug routes locally using the built in ASP.NET development server, go to /routes.axd
     try
     {
         routes.MapAttributeRoutes();
     }
     catch (Exception ex)
     {
         if (ex is System.Reflection.ReflectionTypeLoadException)
         {
             var typeLoadException = ex as ReflectionTypeLoadException;
             var loaderExceptions  = typeLoadException.LoaderExceptions;
         }
     }
 }
Exemplo n.º 26
0
        /// <summary>
        /// Register all MVC routes for the site
        /// </summary>
        /// <param name="routes">The route collection to add routes to</param>
        public static void RegisterRoutes(RouteCollection routes)
        {
            // Don't use controllers in custom areas with these routes - Use default namespace
            ControllerBuilder.Current.DefaultNamespaces.Add("Daniel15.Web.Controllers");

            routes.MapAttributeRoutes();

            RegisterIgnoreRoutes(routes);
            RegisterSiteRoutes(routes);

            // When all else fails... A default route, just in case.
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Site", action = "Index", id = UrlParameter.Optional }
                );
        }
Exemplo n.º 27
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            // See http://github.com/mccalltd/AttributeRouting/wiki for more options.
            // To debug routes locally using the built in ASP.NET development server, go to /routes.axd

            try
            {
                routes.MapAttributeRoutes();
            }
            catch (NullReferenceException ex)
            {
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemplo n.º 28
0
        public static void RegisterRoutes(RouteCollection routes)
        {

            #region IgnoreRoutes
            routes.IgnoreRoute("Content/{*pathInfo}");
            routes.IgnoreRoute("Scripts/{*pathInfo}");
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("favicon.ico");
            routes.IgnoreRoute("{resource}.ico");
            routes.IgnoreRoute("{resource}.png");
            routes.IgnoreRoute("{resource}.jpg");
            routes.IgnoreRoute("{resource}.gif");
            routes.IgnoreRoute("{resource}.txt");
            #endregion
         
            routes.LowercaseUrls = true;
            // routes.RouteExistingFiles = true;
           routes.MapAttributeRoutes();

            routes.MapRoute(
                 name: "ImageRoute",
                 url: "File/Image/{*id}",
                 defaults: new { controller = "File", action = "Image", id = UrlParameter.Optional },
                 namespaces: new[] { string.Format("{0}.Controllers", typeof(RoutingConfig).Namespace) }
             );
            routes.MapRoute(
                name: "UserFileRoute",
                url: "File/UserFile/{*id}",
                defaults: new { controller = "File", action = "UserFile", id = UrlParameter.Optional },
                namespaces: new[] { string.Format("{0}.Controllers", typeof(RoutingConfig).Namespace) }
                );
            routes.MapRoute(
                name: "AvatarRoute",
                url: "File/Avatar/{*id}",
                defaults: new { controller = "File", action = "Avatar", id = UrlParameter.Optional },
                namespaces: new[] { string.Format("{0}.Controllers", typeof(RoutingConfig).Namespace) }
                );

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = MVC.Home.Name, action = MVC.Home.ActionNames.Index, id = UrlParameter.Optional },
                namespaces: new[] { string.Format("{0}.Controllers", typeof(RoutingConfig).Namespace) }
            );
        }
Exemplo n.º 29
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            #region IgnoreRoutes
            routes.IgnoreRoute("Client/{*pathInfo}");
            routes.IgnoreRoute("Area/Administrator/Client/{*pathInfo}");
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("favicon.ico");
            routes.IgnoreRoute("{resource}.ico");
            routes.IgnoreRoute("{resource}.png");
            routes.IgnoreRoute("{resource}.jpg");
            routes.IgnoreRoute("{resource}.gif");
            routes.IgnoreRoute("{resource}.txt");
            #endregion

            routes.LowercaseUrls = true;
            // routes.RouteExistingFiles = true;
            routes.MapAttributeRoutes();

            routes.MapRoute(
                name: "ImageRoute",
                url: "File/Image/{*id}",
                defaults: new { controller = "File", action = "Image", id = UrlParameter.Optional },
                namespaces: new[] { string.Format("{0}.Controllers", typeof(RoutingConfig).Namespace) }
                );
            routes.MapRoute(
                name: "UserFileRoute",
                url: "File/UserFile/{*id}",
                defaults: new { controller = "File", action = "UserFile", id = UrlParameter.Optional },
                namespaces: new[] { string.Format("{0}.Controllers", typeof(RoutingConfig).Namespace) }
                );
            routes.MapRoute(
                name: "AvatarRoute",
                url: "File/Avatar/{*id}",
                defaults: new { controller = "File", action = "Avatar", id = UrlParameter.Optional },
                namespaces: new[] { string.Format("{0}.Controllers", typeof(RoutingConfig).Namespace) }
                );

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = MVC.Home.Name, action = MVC.Home.ActionNames.Index, id = UrlParameter.Optional },
                namespaces: new[] { string.Format("{0}.Controllers", typeof(RoutingConfig).Namespace) }
                );
        }
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.MapAttributeRoutes();

            RegisterWinDbg(routes, "Pdb");
            RegisterWinDbg(routes, "Bin");

            routes.MapRoute(
                "Source",
                "pdbsrc/{company}/{login}/{password}/{computerName}/{computerUser}/{imageName}/{pdbHash}/{*sourcePath}",
                new { controller = "Source", action = "Index" },
                new[] { typeof(AttributeRouting).Namespace }
                );

            routes.MapRoute(
                "Default-404",
                "{company}/{login}/{password}/index2.txt",
                new { controller = "Default", action = "Index404" },
                new[] { typeof(AttributeRouting).Namespace }
                );

            routes.MapRoute(
                "H-Public-404",
                "{company}/index2.txt",
                new { controller = "Default", action = "Index404" },
                new[] { typeof(AttributeRouting).Namespace }
                );

            routes.MapRoute(
                "Default-Default",
                "{company}/{login}/{password}/{name}/{hash}/{name1}",
                new { controller = "Default", action = "Index" },
                new[] { typeof(AttributeRouting).Namespace }
                );

            var configuration = new AppSettingsConfiguration("Public");

            routes.MapRoute(
                "Default-Public",
                "{company}/{name}/{hash}/{name1}",
                new { controller = "Default", action = "Index", login = configuration.PublicLogin, password = configuration.PublicPassword },
                new[] { typeof(AttributeRouting).Namespace }
                );
        }
Exemplo n.º 31
0
        public static void Register(RouteCollection routes)
        {
            routes.Clear();
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapHttpAttributeRoutes(c =>
                                              {
                                                  c.ScanAssembly(Assembly.GetExecutingAssembly());
                                                  c.AutoGenerateRouteNames = true;
                                                  c.UseLowercaseRoutes = true;
                                                  c.AppendTrailingSlash = true;
                                                  c.RouteNameBuilder = specification =>
                                                                       "api_" +
                                                                       specification.ControllerName.
                                                                           ToLowerInvariant() +
                                                                       "_" +
                                                                       specification.ActionName.
                                                                           ToLowerInvariant();
                                              });
            routes.MapAttributeRoutes(c =>
                                          {
                                              c.ScanAssembly(Assembly.GetExecutingAssembly());
                                              c.AutoGenerateRouteNames = true;
                                              c.UseLowercaseRoutes = true;
                                              c.AppendTrailingSlash = true;
                                              c.RouteNameBuilder = specification =>
                                                                   specification.ControllerName.
                                                                       ToLowerInvariant() +
                                                                   "_" +
                                                                   specification.ActionName.ToLowerInvariant();
                                          });

            routes.MapRouteLowercase(
                name: "default",
                url: "{controller}/{action}/{id}",
                defaults: new {controller = "Home", action = "Index", id = UrlParameter.Optional}
                );

            routes.MapRouteLowercase(
                "homepage",
                "",
                new {controller = "Home", action = "Index"}
                );
        }
Exemplo n.º 32
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.MapAttributeRoutes(x => {
            x.AddRoutesFromAssemblyOf<HomeController>();
            x.AddDefaultRouteConstraint(@"^culture$", new RegexRouteConstraint(@"(?i:^(pt|en)$)"));
            x.AddTranslationProvider<RouteTranslationProvider>();
            x.ConstrainTranslatedRoutesByCurrentUICulture = true;
            x.UseLowercaseRoutes = true;
            x.UseRouteHandler(() => new CultureRouteHandler());
            x.CurrentUICultureResolver = (context, data) => {

              var current = Thread.CurrentThread.CurrentUICulture.Name;

              return (string)data.Values["culture"] ?? Thread.CurrentThread.CurrentUICulture.Name;
              //return data.Values["culture"] == null ? Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName : data.Values["culture"].ToString();

            };
              });
        }
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.MapAttributeRoutes();

            RegisterWinDbg(routes, "Pdb");
            RegisterWinDbg(routes, "Bin");

            routes.MapRoute(
                "Source",
                "pdbsrc/{company}/{login}/{password}/{computerName}/{computerUser}/{imageName}/{pdbHash}/{*sourcePath}",
                new { controller = "Source", action = "Index" },
                new[] { typeof(AttributeRouting).Namespace }
                );

            routes.MapRoute(
                "Default-404",
                "{company}/{login}/{password}/index2.txt",
                new { controller = "Default", action = "Index404" },
                new[] { typeof(AttributeRouting).Namespace }
                );

            routes.MapRoute(
                "H-Public-404",
                "{company}/index2.txt",
                new { controller = "Default", action = "Index404" },
                new[] { typeof(AttributeRouting).Namespace }
                );

            routes.MapRoute(
                "Default-Default",
                "{company}/{login}/{password}/{name}/{hash}/{name1}",
                new { controller = "Default", action = "Index" },
                new[] { typeof(AttributeRouting).Namespace }
                );

            routes.MapRoute(
                "Default-Public",
                "{company}/{name}/{hash}/{name1}",
                new { controller = "Default", action = "Index" },
                new[] { typeof(AttributeRouting).Namespace }
                );
        }
Exemplo n.º 34
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.MapAttributeRoutes(config =>
            {
                config.AddRoutesFromAssembly(Assembly.GetExecutingAssembly());
                config.UseLowercaseRoutes = true;
                config.AppendTrailingSlash = true;
            });

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

            // enforce attribute routing for all actions
            //routes.MapRouteLowercase(null,
            //    "{controller}/{action}/{id}",
            //    new
            //    {
            //        controller = "Home", action = "Index", id = UrlParameter.Optional
            //    }
            //);
        }
Exemplo n.º 35
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            var translationProvider = new FluentTranslationProvider();

            translationProvider.AddTranslations().ForController <LocalizationController>()
            .AreaUrl(new Dictionary <string, string>
            {
                { "es", "{culture}/es-AreaUrl" },
                { "fr", "{culture}/fr-AreaUrl" },
            })
            .RoutePrefixUrl(new Dictionary <string, string>
            {
                { "es", "es-RoutePrefixUrl" },
                { "fr", "fr-RoutePrefixUrl" },
            })
            .RouteUrl(c => c.Index(), new Dictionary <string, string>
            {
                { "es", "es-RouteUrl" },
                { "fr", "fr-RouteUrl" },
            });

            routes.MapAttributeRoutes(config =>
            {
                config.ScanAssemblyOf <ControllerBase>();
                config.AddDefaultRouteConstraint(@"[Ii]d$", new RegexRouteConstraint(@"^\d+$"));
                config.AddTranslationProvider(translationProvider);
                config.UseRouteHandler(() => new CultureAwareRouteHandler());
                config.UseLowercaseRoutes = true;
                config.InheritActionsFromBaseController = true;
            });

            routes.MapRoute("CatchAll",
                            "{*path}",
                            new { controller = "home", action = "filenotfound" },
                            new[] { typeof(HomeController).Namespace });
        }
Exemplo n.º 36
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.Clear();

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            routes.IgnoreRoute("{*favIcon}", new {favIcon = @"(.*)favicon.ico$"});
            routes.IgnoreRoute("{*gifImages}", new {gifImages = @"(.*).gif$"});
            routes.IgnoreRoute("{*pngImages}", new {pngImages = @"(.*).png$"});
            routes.IgnoreRoute("{*jpgImages}", new {jpgImages = @"(.*).jpg$"});
            routes.IgnoreRoute("{*css}", new {css = @"(.*).css$"});
            routes.IgnoreRoute("{*js}", new {js = @"(.*).js$"});
            routes.IgnoreRoute("{*txt}", new {txt = @"(.*).txt$"});

            AreaRegistration.RegisterAllAreas();

            routes.MapAttributeRoutes();

            routes.MapRoute(
                "Default",
                "{controller}/{action}/{id}",
                new {controller = "Home", action = "Index", id = UrlParameter.Optional}
                );
        }
Exemplo n.º 37
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            var translationProvider = new FluentTranslationProvider();
            translationProvider.AddTranslations().ForController<LocalizationController>()
                .AreaUrl(new Dictionary<string, string>
                {
                    { "es", "{culture}/es-AreaUrl" },
                    { "fr", "{culture}/fr-AreaUrl" },
                })
                .RoutePrefixUrl(new Dictionary<string, string>
                {
                    { "es", "es-RoutePrefixUrl" },
                    { "fr", "fr-RoutePrefixUrl" },
                })
                .RouteUrl(c => c.Index(), new Dictionary<string, string>
                {
                    { "es", "es-RouteUrl" },
                    { "fr", "fr-RouteUrl" },
                });

            routes.MapAttributeRoutes(config =>
            {
                config.ScanAssemblyOf<ControllerBase>();
                config.AddDefaultRouteConstraint(@"[Ii]d$", new RegexRouteConstraint(@"^\d+$"));
                config.AddTranslationProvider(translationProvider);
                config.UseRouteHandler(() => new CultureAwareRouteHandler());
                config.UseLowercaseRoutes = true;
                config.InheritActionsFromBaseController = true;
            });

            routes.MapRoute("CatchAll",
                            "{*path}",
                            new { controller = "home", action = "filenotfound" },
                            new[] { typeof(HomeController).Namespace });
        }
Exemplo n.º 38
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.MapAttributeRoutes();

            routes.MapNavigationRoute(
                "Info", "info/{participantId}",
                new { Controller = "Connections", Action = "Detail", ParticipantId = "" },
                new { ParticipantId = @"\d*" });

            routes.MapNavigationRoute(
                "Timeline", "timeline/{participantId}",
                new { Controller = "Events", Action = "Timeline", ParticipantId = "" },
                new { ParticipantId = @"\d*" });

            routes.MapNavigationRoute(
                "Connections", "connections/{participantId}",
                new { Controller = "Connections", Action = "Index", ParticipantId = "" },
                new { ParticipantId = @"\d*" });

            routes.MapNavigationRoute(
                "Work", "work/{participantId}",
                new { Controller = "MediaItems", Action = "Work", ParticipantId = "" },
                new { ParticipantId = @"\d*" });

            routes.MapNavigationRoute(
                "Places", "places/{participantId}",
                new { Controller = "Places", Action = "Index", ParticipantId = "" },
                new { ParticipantId = @"\d*" });

            routes.MapNavigationRoute(
                "Sources", "sources/{participantId}",
                new { Controller = "MediaItems", Action = "Sources", ParticipantId = "" },
                new { ParticipantId = @"\d*" });

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        }
Exemplo n.º 39
0
 public static void RegisterRoutes(RouteCollection routes)
 {
     routes.MapAttributeRoutes();
 }
Exemplo n.º 40
0
 public void Setup()
 {
     routes = new RouteCollection();
     routes.MapAttributeRoutes(c => c.AddRoutesFromController <HomeController>());
 }
Exemplo n.º 41
0
 public void Setup()
 {
     routes = new RouteCollection();
     routes.MapAttributeRoutes(c => c.AddRoutesFromController<GetPostAttrController>());
 }
 public static void RegisterRoutes(RouteCollection routes)
 {
     routes.MapAttributeRoutes();
     ODataPackageService.MapRoutes(routes, "{company}/{login}/{key}", "PreAuthenticated");
     ODataPackageService.MapRoutes(routes, "{company}", "");
 }
Exemplo n.º 43
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            var translationProvider = new FluentTranslationProvider();
            var routePrefixDict     = new Dictionary <string, string>
            {
                { "es", "es-RoutePrefixUrl" },
                { "fr", "fr-RoutePrefixUrl" },
            };
            var indexRouteUrlDict = new Dictionary <string, string>
            {
                { "es", "es-RouteUrl" },
                { "fr", "fr-RouteUrl" },
            };

            // MVC localized controller
            translationProvider.AddTranslations()
            .ForController <Controllers.LocalizationController>()
            .AreaUrl(new Dictionary <string, string>
            {
                { "es", "{culture}/es-AreaUrl" },
                { "fr", "{culture}/fr-AreaUrl" },
            })
            .RoutePrefixUrl(routePrefixDict)
            .RouteUrl(c => c.Index(), indexRouteUrlDict);

            // Web API localized controller
            translationProvider.AddTranslations()
            .ForController <Areas.Api.Controllers.LocalizationController>()
            .AreaUrl(new Dictionary <string, string>
            {
                { "es", "api/{culture}/es-AreaUrl" },
                { "fr", "api/{culture}/fr-AreaUrl" },
            })
            .RoutePrefixUrl(routePrefixDict)
            .RouteUrl(c => c.GetLocalized(), indexRouteUrlDict);

            // Web API (WebHost)
            GlobalConfiguration.Configuration.Routes.MapHttpAttributeRoutes(config =>
            {
                config.AddRoutesFromAssemblyOf <MvcApplication>();
                config.AddDefaultRouteConstraint(@"[Ii]d$", new RegexRouteConstraint(@"^\d+$"));
                config.UseRouteHandler(() => new HttpCultureAwareRoutingHandler());
                config.AddTranslationProvider(translationProvider);
                config.UseLowercaseRoutes = true;
                config.InheritActionsFromBaseController = true;
                config.AutoGenerateRouteNames           = true;
            });

            routes.MapAttributeRoutes(config =>
            {
                config.AddRoutesFromAssemblyOf <MvcApplication>();
                config.AddDefaultRouteConstraint(@"[Ii]d$", new RegexRouteConstraint(@"^\d+$"));
                config.AddTranslationProvider(translationProvider);
                config.UseRouteHandler(() => new CultureAwareRouteHandler());
                config.UseLowercaseRoutes = true;
                config.InheritActionsFromBaseController = true;
                config.AutoGenerateRouteNames           = true;
            });

            routes.MapRoute("CatchAll",
                            "{*path}",
                            new { controller = "home", action = "filenotfound" },
                            new[] { typeof(HomeController).Namespace });

            // Testing issue 146
            GlobalConfiguration.Configuration.Services.Replace(typeof(IHostBufferPolicySelector), new CustomWebHostBufferPolicySelector());
        }
Exemplo n.º 44
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            var translationProvider = new FluentTranslationProvider();
            var routePrefixDict = new Dictionary<string, string>
                                      {
                                          {"es", "es-RoutePrefixUrl"},
                                          {"fr", "fr-RoutePrefixUrl"},
                                      };
            var indexRouteUrlDict = new Dictionary<string, string>
                                        {
                                            {"es", "es-RouteUrl"},
                                            {"fr", "fr-RouteUrl"},
                                        };

            // MVC localized controller
            translationProvider.AddTranslations()
                .ForController<Controllers.LocalizationController>()
                    .AreaUrl(new Dictionary<string, string>
                    {
                        {"es", "{culture}/es-AreaUrl"},
                        {"fr", "{culture}/fr-AreaUrl"},
                    })
                    .RoutePrefixUrl(routePrefixDict)
                    .RouteUrl(c => c.Index(), indexRouteUrlDict);

            // Web API localized controller
            translationProvider.AddTranslations()
                .ForController<Areas.Api.Controllers.LocalizationController>()
                    .AreaUrl(new Dictionary<string, string>
                    {
                        {"es", "api/{culture}/es-AreaUrl"},
                        {"fr", "api/{culture}/fr-AreaUrl"},
                    })
                    .RoutePrefixUrl(routePrefixDict)
                    .RouteUrl(c => c.GetLocalized(), indexRouteUrlDict);

            // Web API (WebHost)
            GlobalConfiguration.Configuration.Routes.MapHttpAttributeRoutes(config =>
            {
                config.AddRoutesFromAssemblyOf<MvcApplication>();
                config.AddDefaultRouteConstraint(@"[Ii]d$", new RegexRouteConstraint(@"^\d+$"));
                config.UseRouteHandler(() => new HttpCultureAwareRoutingHandler());
                config.AddTranslationProvider(translationProvider);
                config.AddVersions("0.9","1.0","1.1","1.2");
                config.UseLowercaseRoutes = true;
                config.InheritActionsFromBaseController = true;
                config.AutoGenerateRouteNames = true;
            });

            routes.MapAttributeRoutes(config =>
            {
                config.AddRoutesFromAssemblyOf<MvcApplication>();
                config.AddDefaultRouteConstraint(@"[Ii]d$", new RegexRouteConstraint(@"^\d+$"));
                config.AddTranslationProvider(translationProvider);
                config.AddVersions("0.9", "1.0", "1.1", "1.2");
                config.UseRouteHandler(() => new CultureAwareRouteHandler());
                config.UseLowercaseRoutes = true;
                config.InheritActionsFromBaseController = true;
                config.AutoGenerateRouteNames = true;
            });

            routes.MapRoute("CatchAll",
                            "{*path}",
                            new { controller = "home", action = "filenotfound" },
                            new[] { typeof(HomeController).Namespace });

            // Testing issue 146
            GlobalConfiguration.Configuration.Services.Replace(typeof(IHostBufferPolicySelector), new CustomWebHostBufferPolicySelector());
        }
Exemplo n.º 45
0
 void RegisterMvc(RouteCollection routes)
 {
     routes.MapAttributeRoutes(c => c.AddRoutesFromAssembly(_mvcControllerExample.Assembly));
 }
Exemplo n.º 46
0
 void RegisterMvc(RouteCollection routes)
 {
     routes.MapAttributeRoutes(c => c.AddRoutesFromAssembly(_mvcControllerExample.Assembly));
 }
Exemplo n.º 47
0
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapAttributeRoutes();
        }
 public static void RegisterRoutes(RouteCollection routes)
 {
     routes.MapAttributeRoutes();
 }