Reputation: 8477
My goal is to redirect any URL request under the website to the default (Index) page. Background, I'm migrating from a multiple page website to a SPA page.
I know how to accomplish with the UseMvc syntax, but how do you do the same with the UseEndpoints syntax?
Currently I have the default syntax that is generated in Startup.cs:
app.UseEndpoints(endpoints =>
{
endpoints.MapRazorPages();
});
I'm using ASP.NET Core 3.0.
Upvotes: 1
Views: 496
Reputation: 8477
I found a solution, I put the following line above app.Endpoints line:
app.UseStatusCodePagesWithRedirects("/");
And that redirected everything back to the default/root page.
Upvotes: 1