public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapReportingRoute(); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); }
public static void RegisterRoutes(RouteCollection routes) { routes.MapReportingRoute(); routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "HisPlot", action = "Index", id = UrlParameter.Optional } ); }
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapReportingRoute(); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional, area = "" } // Parameter defaults ); }
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.IgnoreRoute("elmah.axd"); routes.MapReportingRoute(); routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional }, new[] { "Web.Controllers" } ); }
public static void RegisterRoutes(RouteCollection routes) { routes.MapReportingRoute(); routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Admin_elmah", "Admin/elmah/{type}", new { action = "Index", controller = "Elmah", type = UrlParameter.Optional } ); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); }
public static void RegisterRoutes(RouteCollection routes) { routes.MapReportingRoute(); routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( name: "Default", url: "{controller}/{action}/{id}", defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); routes.MapRoute( name: "404-PageNotFound", // This will handle any non-existing urls url: "{*url}", // "Shared" is the name of your error controller, and "Error" is the action/page // that handles all your custom errors defaults: new { controller = "Shared", action = "Error" } ); }
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); //DelimitedTextReportWriter.GetHeaderText = field => field.HeaderText; routes.MapRoute("LegacyUrl", "home/{action}.{extension}", new { controller = "Doddle" }, new { extension = new ReportRouteConstraint() } ); routes.MapReportingRoute(); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional, area = "" } // Parameter defaults ); }
/// <summary> /// Register MVC routes in the application. /// </summary> /// <param name="routes">Existing application route collection.</param> public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" }); routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapReportingRoute(); // For DoddleReports routes.MapRoute( name: MyOpenTrips, url: "Trip/MyOpenTrips", defaults: new { controller = "Trip", action = "MyOpenTrips" } ); routes.MapRoute( name: MyTrips, url: "Trip/MyTrips", defaults: new { controller = "Trip", action = "MyTrips" } ); routes.MapRoute( name: CreateTrip, url: "Trip/Create", defaults: new { controller = "Trip", action = "Create" } ); // I'm fairly certain that the DoddleReports installer fiddled web.config // so that routes that include a file extension get routed through MVC routes.MapRoute( name: TrackWithExtension, url: "Trip/{tripId}/track.{extension}", defaults: new { controller = "Map", action = "Track" }, constraints: new { tripId = IsPositiveInteger, extension = IsMappingExtension } ); routes.MapRoute( name: PositionsWithExtension, url: "Trip/{tripId}/positions.{extension}", defaults: new { controller = "Map", action = "Positions" }, constraints: new { tripId = IsPositiveInteger, extension = IsMappingExtension } ); // For this one, we can set a default extension, preferring compression for what // is likely to be a large file. routes.MapRoute( name: FullTripKml, url: "Trip/{tripId}/full_trip.{extension}", defaults: new { controller = "Map", action = "AllData", extension = "kmz" }, constraints: new { tripId = IsPositiveInteger, extension = IsMappingExtension } ); routes.MapRoute( name: TripMap, url: "Trip/{tripId}/Map", defaults: new { controller = "Map", action = "Index" }, constraints: new { tripId = IsPositiveInteger } ); routes.MapRoute( name: Electronics, url: "Trip/{tripId}/Electronics/{action}", defaults: new { controller = "Electronics", action = "Index" }, constraints: new { tripId = IsPositiveInteger } ); routes.MapRoute( name: Crew, url: "Trip/{tripId}/Crew/{action}", defaults: new { controller = "Crew", action = "Index" }, constraints: new { tripId = IsPositiveInteger } ); routes.MapRoute( name: Ps1, url: "Trip/{tripId}/PS-1/{action}", defaults: new { controller = "Ps1", action = "Index" }, constraints: new { tripId = IsPositiveInteger } ); routes.MapRoute( name: TripInfo, url: "Trip/{tripId}/LL-1/{action}", defaults: new { controller = "TripInfo", action = "Index" }, constraints: new { tripId = IsPositiveInteger } ); routes.MapRoute( name: Gen1Sightings, url: "Trip/{tripId}/Sightings", defaults: new { controller = "Gen1", action = "Sightings" }, constraints: new { tripId = IsPositiveInteger } ); routes.MapRoute( name: EditGen1Sightings, url: "Trip/{tripId}/Sightings/Edit", defaults: new { controller = "Gen1", action = "EditSightings" }, constraints: new { tripId = IsPositiveInteger } ); routes.MapRoute( name: Gen1Transfers, url: "Trip/{tripId}/Transfers", defaults: new { controller = "Gen1", action = "Transfers" }, constraints: new { tripId = IsPositiveInteger } ); routes.MapRoute( name: EditGen1Transfers, url: "Trip/{tripId}/Transfers/Edit", defaults: new { controller = "Gen1", action = "EditTransfers" }, constraints: new { tripId = IsPositiveInteger } ); routes.MapRoute( name: Gen1, url: "Trip/{tripId}/GEN-1/{action}", defaults: new { controller = "Gen1", action = "Index" }, constraints: new { tripId = IsPositiveInteger } ); // A trip has zero to n GEN-2 forms, and each GEN-2 has a "Page X of Y" // field... routes.MapRoute( name: Gen2Details, url: "Trip/{tripId}/GEN-2/{pageNumber}/{action}", defaults: new { controller = "Gen2", action = "Index" }, constraints: new { tripId = IsPositiveInteger, pageNumber = IsPositiveInteger } ); routes.MapRoute( name: Gen2, url: "Trip/{tripId}/GEN-2/{action}", defaults: new { controller = "Gen2", action = "List" }, constraints: new { tripId = IsPositiveInteger } ); routes.MapRoute( name: Gen3, url: "Trip/{tripId}/GEN-3/{action}", defaults: new { controller = "Gen3", action = "Index" }, constraints: new { tripId = IsPositiveInteger } ); routes.MapRoute( name: Gen5, url: "Trip/{tripId}/GEN-5/{action}", defaults: new { controller = "Gen5", action = "Index" }, constraints: new { tripId = IsPositiveInteger } ); // Link to particular GEN-6 page has to come first // due to route precedence routes.MapRoute( name: Gen6Details, url: "Trip/{tripId}/GEN-6/{pageNumber}", defaults: new { controller = "Gen6", action = "Index" }, constraints: new { tripId = IsPositiveInteger, pageNumber = IsPositiveInteger } ); routes.MapRoute( name: Gen6, url: "Trip/{tripId}/GEN-6/{action}/{pageNumber}", defaults: new { controller = "Gen6", action = "List", pageNumber = UrlParameter.Optional }, constraints: new { tripId = IsPositiveInteger, pageNumber = IsPositiveInteger } ); routes.MapRoute( name: LongLineSets, url: "Trip/{tripId}/LL-4/{setNumber}/{action}", defaults: new { controller = "LongLineSampling", action = "List", setNumber = UrlParameter.Optional }, constraints: new { tripId = IsPositiveInteger, setNumber = IsPositiveInteger } ); routes.MapRoute( name: LongLineSampleList, url: "Trip/{tripId}/LL-4/", defaults: new { controller = "LongLineSampling", action = "List" }, constraints: new { tripId = IsPositiveInteger } ); // Even though Set is subordinate to day, allow link directly to list of sets // and to a particular set number routes.MapRoute( name: Sets, url: "Trip/{tripId}/Sets/{setNumber}/{action}", defaults: new { controller = "FishingSet", action = "List", setNumber = UrlParameter.Optional }, constraints: new { tripId = IsPositiveInteger, setNumber = IsPositiveInteger } ); /* routes.MapRoute( name: "Ps4ByPageAndColumn", url: "Trip/{tripId}/PS-4/Pages/{pageNumber}/Column/{columnNumber}", defaults: new { controller = "Ps4", action = "Column" }, constraints: new { tripId = IsPositiveInteger, pageNumber = IsPositiveInteger, columnNumber = IsPositiveInteger } ); routes.MapRoute( name: Ps4ByPage, url: "Trip/{tripId}/PS-4/Pages/{pageNumber}", defaults: new { controller = "Ps4", action = "Page" }, constraints: new { tripId = IsPositiveInteger, pageNumber = IsPositiveInteger } ); */ // This route has the 'Add' verb in the URL to prevent routing confusion with // the next route (Ps4BySetAndPage). routes.MapRoute( name: AddPs4, url: "Trip/{tripId}/PS-4/{setNumber}/Add", defaults: new { controller = "Ps4", action = "Add" }, constraints: new { tripId = IsPositiveInteger, setNumber = IsPositiveInteger } ); routes.MapRoute( name: Ps4BySetAndPage, url: "Trip/{tripId}/PS-4/{setNumber}/{pageNumber}/{action}", defaults: new { controller = "Ps4", action = "Index" }, constraints: new { tripId = IsPositiveInteger, setNumber = IsPositiveInteger, pageNumber = IsPositiveInteger } ); routes.MapRoute( name: Ps4List, url: "Trip/{tripId}/PS-4/", defaults: new { controller = "Ps4", action = "List" }, constraints: new { tripId = IsPositiveInteger } ); routes.MapRoute( name: "Ps4SampleColumn", url: "Trip/{tripId}/Samples/{headerId}/{offset}/{action}", defaults: new { controller = "PurseSeineSample", action = "Index" }, constraints: new { tripId = IsPositiveInteger, headerId = IsPositiveInteger, offset = IsPositiveInteger } ); // TODO: This will probably go out the window // Although length samples are subordinate to Sets, they'll be available at a higher level // for a more readable URL. routes.MapRoute( name: LengthSamples, url: "Trip/{tripId}/Samples/{setNumber}/Page/{pageNumber}", defaults: new { controller = "LengthSample", action = "Index", pageNumber = UrlParameter.Optional }, constraints: new { tripId = IsPositiveInteger, setNumber = IsPositiveInteger, pageNumber = IsPositiveInteger } ); routes.MapRoute( name: LengthFrequencyByTrip, url: "Trip/{tripId}/LengthFrequency.xlsx", defaults: new { controller = "LengthSample", action = "AllSamples" }, constraints: new { tripId = IsPositiveInteger } ); routes.MapRoute( name: ExcelTripSummary, url: "Trip/{tripId}/TripSummary.xlsx", defaults: new { controller = "Export", action = "Summary" }, constraints: new { tripId = IsPositiveInteger } ); routes.MapRoute( name: SeaDays, url: "Trip/{tripId}/Days/{dayNumber}/{action}", defaults: new { controller = "SeaDay", action = "List", dayNumber = UrlParameter.Optional}, constraints: new { tripId = IsPositiveInteger, dayNumber = IsPositiveInteger } ); routes.MapRoute( name: SeaDayById, url: "Trip/{tripId}/DayById/{dayId}/{action}", defaults: new { controller = "SeaDay", action = "Index" }, constraints: new { tripId = IsPositiveInteger, dayId = IsPositiveInteger } ); routes.MapRoute( name: WellContents, url: "Trip/{tripId}/WellContent/{action}", defaults: new { controller = "WellContent", action = "Index" }, constraints: new { tripId = IsPositiveInteger } ); routes.MapRoute( name: PageCount, url: "Trip/{tripId}/PageCount/{action}", defaults: new { controller = "PageCount", action = "Index" }, constraints: new { tripId = IsPositiveInteger } ); routes.MapRoute( name: TripDetails, url: "Trip/{tripId}/{action}", defaults: new { controller = "Trip", action = "Details" }, constraints: new { tripId = IsPositiveInteger } ); // TODO: Consider changing route to LL-2? (Problem is that the form is LL-2/3, and '/' isn't great in a route URL) routes.MapRoute( name: SetHaul, url: "Trip/{tripId}/SetHaul/{setNumber}/{action}", defaults: new { controller = "SetHaul", action = "List", setNumber = UrlParameter.Optional }, constraints: new { tripId = IsPositiveInteger, setNumber = IsPositiveInteger } ); routes.MapRoute( name: RssFeed, url: "Trip/Rss", defaults: new { controller = "Trip", action = "Rss" } ); // Can this route replace the fairly generic routes? // Doesn't look like it... routes.MapRoute( name: TripDefault, url: "Trip/{tripId}/{controller}/{action}", defaults: new { action = "Index" }, constraints: new { tripId = IsPositiveInteger } ); routes.MapRoute( name: TripList, url: "Trip/", defaults: new { controller = "Trip", action = "Index" } ); routes.MapRoute( name: Default, // Route name url: "{controller}/{action}/{id}", // URL with parameters defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); }
/// <summary> /// Register the ReportingRoute. This Route allows ReportResult Actions to be accessed via a file extension in the URL, for example http://localhost/MyController/MyActionResult.html to get an HTML Report /// </summary> public static Route MapReportingRoute(this RouteCollection routes) { return(routes.MapReportingRoute(null, null)); }