Skip to main content

Posts

Showing posts with the label Blazor-Technology

Part-2 Blazor Server Cookie Authentication

In this article, we are going to implement User Registration logic in the Blazor Server application. In this part of the article, we have to accomplish our targets like: User Registration Form. Password Hashing User Registration Logic. Click here for part-1 Create Asp.Net Core Areas Folder: We are going to create Razor Pages for our User Registration, so let store them in the 'Areas' folder. So let's create 'Areas' folders and also add the 'Layout' template and a few other additional configurations. Now let's create folders into our application like 'Areas\Identity\Pages\Account' , 'Areas\Identity\Pages\Shared' . Let's create a new layout for the pages inside of the 'Areas' folder. Let's create the layout file '_Layout.cshtml'. Areas/Identity/Pages/Shared/_Layout.cshtml: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta name="vie

Part-1 Blazor Server Cookie Authentication

In .Net applications, authentication can be simply accomplished with cookies without using any built-in authentication provider like 'Asp.Net Core Identity', 'Identity Server', 'Auth0', etc. This series is about implementing simple cookie-based authentication in the Blazor Server application. In this part of the article, we have to accomplish our targets like: Creating user authentication tables. Creating Blazor Server Application. Installing Entity Framework core. Configuring Database Context. Tables For Authentication: User - table store user information like 'email', 'password', 'firstname', 'lastname', etc. Roles - master table to store the roles like 'admin', 'user', 'manager',etc. UserRoles - a mapping table for the 'Users' & 'Roles' table to store the user roles information. Create Users Table: CREATE TABLE [dbo].[Users]( [Id] [int] IDENTITY(1,1) NOT NULL, [FirstName] [va

A Demo On File Downloading In Blazor WebAssembly Application[.NET 6]

In this article, we are going to do a demo on file downloading in the blazor webassembly application. Create A .Net6 Blazor WebAssembly Application: Let's create a .Net6 Blazor WebAssembly sample application to accomplish our demo. We can use either Visual Studio 2022 or Visual Studio Code(using .NET CLI commands) to create any.Net6 application. For this demo, I'm using the 'Visual Studio Code'(using the .NET CLI command) editor. CLI command dotnet new blazorwasm -o Your_Project_Name Install And Configure HttpClient Instance: Install the 'Microsoft.Extensions.Http' NuGet. Package Manager Install-Package Microsoft.Extensions.Http -Version 6.0.0 CLI command dotnet add package Microsoft.Extensions.Http --version 6.0.0 Now register the 'AddHttpClient' in the 'Program.cs'. Program.cs: builder.Services.AddHttpClient(); Implement File Downloading Logic: Let's implement our sample in the 'Index.razor' page component. First, let&

Built-in DynamicComponent Blazor Component[.NET6 Feature]

In this article, we will understand about a .NET6 feature that is built-in 'DynamicComponent' in the Blazor application. DynamicComponent: In Blazor from .NET6 introduced a built-in component that is 'DynamicComponent' for dynamic rendering of the razor components. So using DynamicComponent we can render different types of components very easily without using any conditional logic. Also can pass appropriate parameters to their respective components on rendering dynamically. Create A .NET6 Blazor WebAssembly Application: Let's create a .Net6 Blazor WebAssembly sample application to accomplish our demo. We can use either Visual Studio 2022 or Visual Studio Code(using .NET CLI commands) to create any.Net6 application. For this demo, I'm using the 'Visual Studio Code'(using the .NET CLI command) editor. CLI command dotnet new blazorwasm -o Your_Project_Name Example Using DynicComponent: By default on creating project we have 3 components like

Implementing AspNetCore Identity Authentication In To An Existing Blazor Server App[.NET6]

In this article, we will implement AspNetCore Identity Authentication into an existing Blazor Server app. Microsoft AspNetCore Identity Library: AspNetCore Identity: Built-in login functionality library that supports authentication of all different .NET applications. Provides rich authentication UI pages and customizable as well. Adoptable for external authentication providers like 'Google', 'Facebook', 'Outlook'. Can be integrated with other authentications like 'IdentityServer4', 'Azure Active Directory', 'Azure Active Directory B2C(Azure AD B2C)'. Blazor Server Project With No Authentication: Our goal is to implement the AspNetCore Identity Authentication manually into an existing Blazor Server application(the project doesn't have authentication). So to accomplish our demo let's create a Blazor server application without any authentication. We can use either Visual Studio 2022 or Visual Studio Code(using .NET CLI commands)

Blazor Server Authentication And Authorization Using Microsoft AspNetCore Identity[.NET6]

In this article, we are going to do a small demo on Blazor Server authentication and authorization using Microsoft AspNetCore Identity. Microsoft AspNetCore Identity Library: AspNetCore Identity: Built-in login functionality library that supports authentication of all different .NET applications. Provides rich authentication UI pages and customizable as well. Adoptable for External Authentication providers like 'Google', 'Facebook', 'Outlook'. Can be integrated with other authentication like 'IdentityServer4', 'Azure Active Directory', 'Azure Active Directory B2C(Azure AD B2C)'. Create A .NET6 Blazor Server App With Individual Authentication: Let's create a .Net6 Blazor Server sample application with individual authentication to accomplish our demo. We can use either Visual Studio 2022 or Visual Studio Code(using .NET CLI commands) to create any.Net6 application. For this demo, I'm using the 'Visual Studio Code'(using