admin管理员组

文章数量:1392088

I'm creating a new solution using the template for .NET MAUI Blazor Hybrid and Web App. Using the solution out-of-the-box is working. When I start to add the pages, I'm having some issues. Just for clarity, I get those projects:

  • Mobile is the MAUI implementation using the webview
  • Shared is where there are Razor pages
  • Web is the web application in Blazor
  • Web Client is the client Blazor application

So, I have the website created in Tailwind and there are 2 different templates: one for the public website and another one for the admin section.

Each section has an header and in this header, I have a user menu where I have to display the user details. The authentication is with Individual Identity. The admin section uses the web API in the web application and the Interactive mode and get the current user. For this reason, I placed all the pages in the client project. My first question is how display those pages in the mobile?

When I add images or CSS in the Shared project, those are not available in the web or web client projects. I tried to use something like

<link rel="stylesheet" href="@Assets["css/site.css"]" />

but if the resource is not present in the server or client project, it is not visible in the web application.

The last part is about the layouts. I have 2 of them, one for the front end and one for the admin section. If I place the AdminMainLayout.razor in the client project, in all the pages, I can choose the layout using

@layout AdminMainLayout

but in this case, I don't have access to the

@inject AuthenticationStateProvider _authenticationStateProvider
@inject IdentityRedirectManager RedirectManager
@inject UserManager<ApplicationUser> UserManager;

If I place the AdminMainLayout.razor in the server project, I can't use it in the client project because the layout is not recognized. If I place this layout in the Shared project, again, I don't have access to the UserNamager and other functionalities. Also, I don't know how to have those pages in the mobile.

本文标签: cMAUI Blazor Hybrid and multiple frontend layoutsStack Overflow