jQuery with Blazor

Example 1 index.html Note: Script tags should not be placed inside components because they cannot be updated dynamically. To fix this, move the script tag to the ‘index.html’ file or another static location. MainLayout.razor or in the MainLayoutBase.cs Example 2 Sources: https://www.syncfusion.com/faq/blazor/general/how-do-i-use-jquery-ui-components-in-a-blazor-application https://www.syncfusion.com/faq/blazor/javascript-interop/is-there-a-way-to-access-dom-in-blazor https://stackoverflow.com/questions/54274629/how-to-use-jquery-ui-from-blazor-component

AuthenticationStateProvider vs AuthenticationState

AuthenticationStateProvider AuthenticationState AuthenticationStateProvider vs AuthenticationState Blazor has a built-in service called AuthenticationStateProvider service. This service obtains authentication state data from ASP.NET Core’s HttpContext.User. This is how authentication state integrates with existing ASP.NET Core authentication mechanisms. It is this service that is used by AuthorizeView component and CascadingAuthenticationState component to get the authentication state. Don’t use AuthenticationStateProvider directly. Use the AuthorizeView component. The main drawback to using AuthenticationStateProvider directly... » read more

Custom Identity Claim in Blazor

1. Create new field of string type in the AspNetUsers table of Identity database. 2. Add field to ApplicationUser class. (Server) 3. Create new class called CustomUserClaimsPrincipalFactory 4. Add to ConfigureServices in Startup.cs (Server) Note: As soon as the line .AddClaimsPrincipalFactory<CustomUserClaimsPrincipalFactory>(); is added, role does not work anymore.

Secure an ASP.NET Core Blazor WebAssembly hosted app with Identity Server

Note: Need to configure both .Client and .Server projects. .Client Create a new class called CustomUserFactory.cs Add to Main of Program.cs (Client) .Server Add to ConfigureServices of Startup.cs (Server) Result Index.razor (Client) OrgAdminOnly.razor (Client) Sources: https://docs.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/hosted-with-identity-server?view=aspnetcore-3.1&tabs=visual-studio

Store does not implement IUserRoleStore

When configuring Blazor Identity … Error: NotSupportedException: Store does not implement IUserRoleStore<TUser>. var roles = await _signInManager.UserManager.GetRolesAsync(user); Fix: Add .AddRoles<IdentityRole>() to Configuration of Startup.cs