Skip to main content


Angular State Management With NgRx

Introduction: NgRx framework helps Angular to develop more reactive applications. NgRx provides state management to an application, where data of an application is stored at a single place and then supplied throughout the application where ever needed. Using NgRx if data is updated, all the components consuming that data get updated instantly. Benefits of using NgRx with Angular application like Serializability, Type Safety, Encapsulation, Testable, and Performance. Key Features: NgRx framework key features like Store: A  s tore is a data place where all the application related information stored and supplied to the Angular components on demand. Reducer: A reducer is a pure function based on Actions it returns the new state. Actions: An action expresses an event of an application, that causes a change in the state of the application. Selector: A selector is a pure function that obtains a slice of data from the store. Effects: An Effect is to isolate components f

Dotnet Core MVC Cookie Login Sample Role-based Authorization (Part 2)

Introduction: Authorization means an authenticated user having permission to access specific protected resources. In general, Authorization can be called special permissions. For example in an application, an admin user has all permission to modify the application, a non-admin user might have permission likes read-only content in the application. In the  first article , we have discussed the Cookie-Based login mechanism. This will be a continuation article, here we discuss Authorization. Note: Before reading this article, read  Dotnet Core Cookie Login Sample (Part 1) . Pages Controller: Now add a new controller name as 'PagesController.cs' and to this controller add 3-action methods to show 3 pages in the application. PagesController.cs: namespace CookieAuth.Web.Controllers { [Route("pages")] public class PagesController : Controller { [Route("admin")] [HttpGet] public IActionResult Admin() {

Dotnet Core MVC Cookie Login Sample From Scratch(Part 1)

Introduction: In general ASP.NET Core applications(MVC, RazorPages, WebAPI, Blazor Server Side) use login libraries like ASP.NET Core Identity , IdentityServer4 , OAuth 2.0 , etc. But ASP.NET Core can simply implement login with using Cookie-Based Authentication  without any login libraries. ASP.NET Core Identity  is a membership program that helps to create a login functionality. Its rich library with all default login functionalities, creating users, adding roles, password encryption, and support to social logins like Google, Facebook, Outlook, Twitter, etc. IdentityServer4 Or OAuth 2.0  is the latest login technology. It also gives all login functionalities and support to social logins as well additionally Single Sign-On and   Token-Based user login. Cookie-Based Authentication  is a default login mechanism provided by ASP.NET Core applications. But user creation, adding roles need to be done manually which is not hard to do. In this approach, we don't

Blazor WebAssembly Dynamic Form Validation

Introduction: In Blazor WebAssembly(client-side framework) form validation can be done with Data Annotations. Using Data Annotations we can validate form either by default validation attributes or by creating custom validation attributes. Using this Data Annotation attribute we can dynamically add or remove validation on a specific field in a form. Create Blazor WebAssembly Project: To create a Blazor WebAssembly template project need to install the latest version of VisualStudio 2019 for rich intelligence support or we can use VisualStudio code but less intelligence support from the editor.  Click here to know about Blazor WebAssembly template creation. Blazor WebAssembly is in preview mode, not yet ready for production. Create Razor Component: After creating a sample project using the Blazor WebAssembly template, in "Pages" folder add new Razor Component , name it as "UserForm.razor" Add Route: In Blazor routing can be configured using @

NestJS API CRUD Operations With MongoDB

Introduction: NestJS is a framework used to develop server-side applications. NestJS built on top of Node.js frameworks like Express. It is a combination of Progressive Javascript, Object-Oriented Programming, Functional Programming, and Functional Reactive Programming. Nest CLI Installation: Using Nest CLI we are able to generate the NestJS starter project with the default template. To install Nest CLI globally over our system open command prompt and run the command               npm i -g @nestjs/cli Now create a sample project by using Nest CLI command              nest new your_project_name package.json: Now open the package.json file from the sample application created, you can observe few properties like "scripts", "dependencies", and "devDependencies". "dependencies" contains all plugins to be installed and used them to run the application. "devDependencies" contain all plugins to be installed and used them