4
votes

I have a blazor app, but it is divided in 2 parts. - a web site with several web pages - a Blazor Application

By default, I wish to navigate to the "index.html" page. This one will have a "login" link that will redirect to the main application page.

How can I do this... by default I'm directed to the index.cshtml (ie. the blazor app) ?

1

1 Answers

6
votes

I wish to navigate to the "index.html" page.

Assume you have put the index.html within the wwwroot/ folder, you could achieve that by registering a DefaultFiles middleware:

app.UseDefaultFiles();    // add this line before invoking app.UseStaticFiles();
app.UseStaticFiles();

...

(Note the order of middlewares is important)

Or if you want to put index.html within a different location, you could pass a custom FileProvider (e.g. PhysicalFileProvider). For more details, see official docs.