I’m new to asp.net and Blazor Webassembly projects.
I created a Blazor Webassembly hosted project with identity. This has 3 main parts client, server, and shared. Currently I’m trying to get a list of all the registered users from the identity database which has been already created by default.
I created a razor component to view the users but failed to get the model class since it is in the server project. I also tried to move the ApplicationUser model class from the server to shared and installed the Identity NuGet package in shared but it resulted in an error(not supported by design).
Is there a sensible approach to list all the users available in the asp identity users, preserving the mvc model?
Thanks in advance.
2
Answers
Thanks, John for your detailed answer.
I'll post the solution which worked for me.
Inside App.Shared
User.cs
Inside App.Server/Models folder
ApplicationUser.cs
Inside App.Server/Controllers folder
UsersController.cs
Razor View Component
Final Output
@Lilan… I have working code that displays a page listing Identity-Users (data). For our TM_PWA VS-2022 SOLUTION: .Net CORE-6, Blazor App-hosted-PWA:
In the Blazor-Client-project, NavMenu.razor
This code is in the Blazor-SERVER project.
HTML: UserList.cshtml in Areas/Identity/Pages/Account-folder
C# : UserList.cshtml.cs in Areas/Identity/Pages/Account-folder