Tutorials on ASP.NET Core, Blazor, jQuery, JavaScript, Entity Framework, Identity, WordPress, SQL, HTML & more


Filters in ASP.NET Core – Beginner to Expert level

Last Updated: July 31, 2022

filters aspnet core

Filters in ASP.NET Core are used to run code before or after certain stages in the request processing pipeline. There are many built-in filters for authorization, logging, caching, exception handling and so on. Filters also help to avoid code-duplication in our projects.

What is difference between middleware and filters in .NET Core? Middlewares operate on each and every request coming to a .NET Core app on the other hand Filters operated only on request coming to MVC pipeline. Middlewares do not have access to HttpContext but filters have. We can run filters on specified actions and controllers (cannot do this on Middlewares) unless we register the filter globally in the program class.

(more…)

How to use jQuery Remove Method for removing Elements from DOM

Last Updated: June 3, 2021

jquery remove

When you want to remove an element from the DOM use jQuery Remove Method. The .remove() will remove elements along with its children.

(more…)

Model Validation in ASP.NET Core [Beginner to Expert]

Last Updated: October 4, 2023

aspnet core model validation

What is Model Validation in ASP.NET Core? Model Validation is a technique to provide rules for model properties and validating these rules so that they are not broken. When rules are broken then appropriate error messages are displayed to the clients and this helps the clients to rectify the problems.

In this tutorial we are going to learn Model Validation with examples. So let us start without any delay.

(more…)

Advanced Model Binding Concepts in ASP.NET Core

Last Updated: May 20, 2022

aspnet core advanced model binding

In this tutorial we will cover some of the most Advanced Model Binding Concepts with examples.

(more…)

Model Binding in ASP.NET Core from Beginner to Advanced

Last Updated: May 17, 2022

Model Binding aspnet core

What is model binding in ASP.NET Core? It is a process to Extract Data from HTTP Requests and provide them to the arguments of Action Method. Models contain the data that forms the business logic of the app. They are basically C# classes that contain the data from a database or other data source.

In ASP.NET Core there are 2 most important topics dealing with Models:

  • 1. Model Binding – a process of extracting data from HTTP request and providing them to the action method’s arguments.
  • 2. Model Validation – a process to validate the Model properties so that invalid entries are not entered in the database.

In this tutorial you will learn about Model Binding process in details.

(more…)

Custom Tag Helper in ASP.NET Core

Last Updated: May 14, 2022

aspnet core custom tag-helpers

In the last tutorial we covered Built-In Tag Helpers in ASP.NET Core. Now we will learn to create Custom Tag Helper for transforming the html elements with C# codes. We will take a lot of examples so make sure to go through each of the sections on this tutorial.

This tutorial is a part of the series called Tag Helpers in ASP.NET Core. It contains 3 tutorials.

(more…)

Built-In Tag Helpers in ASP.NET Core

Last Updated: May 11, 2022

built-in tag helpers asp.net core

Many of the ASP.NET Core Tag Helpers comes pre-built in the framework and are represented as asp-* attributes. They perform tasks like enhancing forms, validation messages, designing layouts and so on. In this section I am going to discuss about the built in Tag Helpers for Form, Input, Select, Label, Anchor, Text Area elements, CSS, JS and Cache.

This tutorial is a part of the series called Tag Helpers in ASP.NET Core. It contains 3 tutorials.

(more…)

Introduction to Tag Helpers in ASP.NET Core

Last Updated: May 5, 2022

tag helpers introduction

What are Tag Helpers in ASP.NET Core ? Tag Helpers are reusable components in ASP.NET Core. They are used to perform "defined transformations on HTML elements" from C# codes before being rendered on the views. With Tag Helpers we can enable server-side code to participate in creating and rendering the HTML elements. The most commonly used tag helpers are asp-controller and asp-action which assigns the controller & action for generating the URL. Example: <a asp-controller="Shop" asp-action="Clothes">Buy Clothes</a> will generate HTML <a href"/Shop/Clothes">Buy Clothes</a>.

(more…)

How to Call Web API in ASP.NET Core [.NET 7.0]

Last Updated: October 21, 2023

aspnet core consume api

On my previous tutorial called How to Create Web APIs in ASP.NET Core [RESTful pattern] I created a Web API. Now I will call this API (i.e. consume the API) in another project known as client.

(more…)

How to Create Web APIs in ASP.NET Core [.NET 7.0 RESTful pattern]

Last Updated: October 21, 2023

api controllers aspnet core

Creating Web APIs in ASP.NET Core is very straightforward. You create controllers that have 3 things:

  • 1. They should have [ApiController] attribute on them. This attribute tells that the controller will server HTTP API Responses.
  • 2. They should derive from ControllerBase class instead of Controller class.
  • 3. They should have attribute routing applied on them like [Route("someUrl/[controller]")].

The controller of a Web API looks like:

(more…)