public override void RegisterRoutes(RouteCollection routes) { //routes.IgnoreRoute(@".*"); // Block all routes routes.IgnoreRoute(@"^.*css.*$"); // Block all routes to the css folder routes.MapRoute( name: "Default", regex: @"^[/]{1}$", defaults: new DefaultRoute { controller = "", action = "index.html", id = "" } ); routes.MapRoute( name: "Json", regex: @"\json$", defaults: new DefaultRoute { controller = "Test", action = "GetJson", id = "" } ); routes.MapRoute( name: "Allow All", regex: @".*", defaults: new DefaultRoute { controller = "", action = "", id = "" } ); //routes.MapRoute( // name: "Deny All", // regex: @"$a", // defaults: new DefaultRoute { controller = "", action = "", id = "" } //); }
public virtual void RegisterRoutes(RouteCollection routes) { routes.MapRoute( name: "Allow All", regex: @".*", defaults: new DefaultRoute { controller = "", action = "", id = "" } ); }
public override void RegisterRoutes(RouteCollection routes) { routes.MapRoute( name: "Default", regex: @"^[/]{1}$", defaults: new DefaultRoute { controller = "home", action = "gethello", id = "" } ); routes.MapRoute( name: "Allow All", regex: @".*", defaults: new DefaultRoute { controller = "", action = "", id = "" } ); }
/// <summary> /// Invoke the <see cref="RegisterRoutes"/> method in <see cref="RouteConfig"/>. /// </summary> /// <param name="routes">Routes.</param> private void Invoke(RouteCollection routes) { Type configType = typeof(HttpApplication); Type routeType = Find(configType); if (routeType != null) { var routeConfig = (HttpApplication)ServiceResolver.Current.Resolve(routeType); if (routes != null) { routeConfig.RegisterRoutes(routes); } } }
public override void RegisterRoutes(RouteCollection routes) { // block access to the 'Deny' folder. routes.IgnoreRoute(@"^.*deny.*$"); // maps the root folder specificly to 'index.html'. routes.MapRoute( name: "Default", regex: @"^[/]{1}$", defaults: new DefaultRoute { controller = "Home", action = "Index", id = "" } ); // allows access to all other folders and files not explicitly ingored. routes.MapRoute( name: "Allow All", regex: @".*", defaults: new DefaultRoute { controller = "", action = "", id = "" } ); }
/// <summary> /// Invoke the <see cref="RegisterRoutes"/> method in <see cref="RouteConfig"/>. /// </summary> /// <param name="routes">Routes.</param> private void Invoke(RouteCollection routes) { Type configType = typeof(HttpApplication); Type routeType = Find(configType); if (routeType != null) { var routeConfig = (HttpApplication)ServiceResolver.Current.Resolve(routeType); if (routes != null) routeConfig.RegisterRoutes(routes); } }