Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Asp.net Core 2 Razor Pages MapSpaFallback suggestion #1354

Closed
@pholly

Description

@pholly

MapSpaFallback works well for MVC routes but does not exist for the new Razor Pages.

If SpaRouteConstraint were public instead of internal with a little work developers can add the constraint to Razor pages:

//Starup.cs ConfigureServices
//thank you Scott Hanselman https://www.hanselman.com/blog/AddingACustomInlineRouteConstraintInASPNETCore10.aspx
services.Configure<RouteOptions>(options => 
                options.ConstraintMap.Add("spaRoute", typeof(SpaRouteConstraint)));
services.AddMvc()
                .AddRazorPagesOptions(options =>
                {
                    options.Conventions.AddPageRoute("/Index", "{*catchAll:spaRoute(catchAll)}");
                });

Would be even better if JavaScriptServices somehow added SpaRouteConstraint to the ConstraintMap.

For now I'll just copy the SpaRouteConstraint class.
Thanks,
Philip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions