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 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 void Setup() { assertEngine = new FakeAssertEngine(); RouteAssert.UseAssertEngine(assertEngine); routes = new RouteCollection(); routes.MapAttributeRoutes(c => c.AddRoutesFromController<HomeAttrController>()); }
public static void RegisterRoutes(RouteCollection routes) { routes.MapAttributeRoutes(config => { config.AddRoutesFromAssemblyOf <HomeController>(); config.AppendTrailingSlash = true; config.UseLowercaseRoutes = true; }); }
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(); }
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(); }
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; }); }
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; }); }
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; }); }
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 } ); }
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; }); }
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; }); }
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" }); }
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" } // ); }
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 }); }
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 }); }
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"); } ); }
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; } } }
/// <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 } ); }
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; } }
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) } ); }
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 } ); }
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"} ); }
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 } ); }
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 // } //); }
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 }); }
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} ); }
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 }); }
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}"); }
public static void RegisterRoutes(RouteCollection routes) { routes.MapAttributeRoutes(); }
public void Setup() { routes = new RouteCollection(); routes.MapAttributeRoutes(c => c.AddRoutesFromController <HomeController>()); }
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}", ""); }
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()); }
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()); }
void RegisterMvc(RouteCollection routes) { routes.MapAttributeRoutes(c => c.AddRoutesFromAssembly(_mvcControllerExample.Assembly)); }
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapAttributeRoutes(); }