Skip to main content

Posts

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

Mongo Shell Commands Quick Start

Introduction: MongoDB is a document-oriented database, which is classified as a NoSQL database. In MongoDB, tables are called collections and records are called documents. It stores data in JSON format. The reading of data from MongoDB is fast when compared to the Relational Database. Installation: Install MongoDB Community Edition . Here we run MongoDB as a windows server for local development and for learning MongoDB. After successful installation, go to the location "C:\Program Files\MongoDB\Server\4.2\bin" then run "mongod.exe" which starts MongoDB server as windows server. Uses port "27017" as default to serve the requests. Run "mongo.exe" shell command, used as an interface to query the MongoDB. Query Commands: Database: Create a new database by running the command "use your_database_name" on the  "mongo.exe" shell command. To see all the existing databases run the command "show dbs"

Dotnet Core Basic CRUD Operations With MongoDB Using Repository Pattern

Introduction: MongoDB is a document-oriented database, which is classified as a NoSQL database. In MongoDB, tables are called collections and records are called documents. It stores data in JSON format. The reading of data from MongoDB is fast when compared to the Relational Database. But MongoDB doesn't have a relation between the collections. We can't declare NoSQL is better than SQL or vice-versa. So depending on the application requirement either select NoSQL or SQL or Both database. Dotnet Core by default uses an MSSQL database, but it has built-in support for all other types of datastores like MYSQL, ORACLE, and MongoDB, etc. Step 1: Click here  to install the MongoDB community edition. After successful installation go to  "C:\Program Files\MongoDB\Server\4.2\bin" and then run "mongod.exe". Now we started MongoDB server in our local machine on a default port 27017. Step 2: Now open MongoDB shell command "mongo.exe" which is found