question

Robdob-4164 avatar image
0 Votes"
Robdob-4164 asked Robdob-4164 edited

routing all .html to proper razor pages in Server side Blazor

Hi,

I have an older website where I'm doing a lot of urlrewrite stuff to my old .aspx files. I'm now trying to covert this site to blazor and I would like to be able to access a lot of m blazor site using direct .html filenames within the urls.

so I have a .razor page and within it I have:

@page "/information-on-mystuff.html" in my razor pages

and then within the startup.cs file I have something like this:

 app.UseEndpoints(endpoints =>
             {
                 endpoints.MapControllers();
                 endpoints.MapBlazorHub();
                 endpoints.MapFallbackToPage("/_Host");
    
                 // I added this next line in to make /information-on-mystuff.html properly display on browser refresh
                 endpoints.MapFallbackToPage("/information-on-mystuff.html", "/_Host"); 
             });

doing this works correctly but is it possible to have a wild card something like:



  endpoints.MapFallbackToPage("/*.html", "/_Host");

I have many routes that I will need to convert from my old asp.net site which is making use of the urlrewritre module extensively and I want like to know what the best way to do this is. I would also like to keep access to all of .html pages because my older site is already doing well in SEO and I don't want all these pages to disappear..

Any help would be great!

thanks in advance..



dotnet-aspnet-core-blazor
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers