Blazor app with ASP.NET Identity UI shared layuout template

944 views Asked by At

I have a default Blazor application with a MainLayout.cshtml file. created as follows;

- MyBlazorApp/
-- Shared/
--- MainLayout.cshtml

Within this application I have scaffolded various ASP.NET Identity pages (login, logout etc), which have their own structure and a _layout.cshtml template created as follows;

- MyBlazorApp
-- Areas/
--- Identity/
---- Pages/
----- _ViewStart.cshtml  <-- references "/Pages/Shared/_Layout.cshtml"
-- Pages/
--- Shared/
---- _layout.cshtml

I want to have one template file that both applications use. Which way round should this be configured?

1

There are 1 answers

10
enet On BEST ANSWER

I don't think this is possible. The Blazor's lay out, MainLayout is a component whose file name's extension is .razor (MainLayout.razor ). On the other hand, _Layout.cshtml is a Razor Page... As you can embed a razor component in a Razor Page, you can embed the MainLayout in _Layout.cshtml. But this it...