Tutorials on ASP.NET Core, Blazor, jQuery, JavaScript, Entity Framework, Identity, WordPress, SQL, HTML & 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…)

Areas and Routing in ASP.NET Core

Last Updated: May 2, 2022

aspnet core areas

The concept of Routing is very vast and I have covered it in 6 tutorials which are:

So make sure you cover each of these one by one.

ASP.NET Core Areas represent a functional segment of the application. It can be administration, billing, sales, etc. If our application becomes very large then it will have many controllers, Models & Views. We can create multiple Areas to distribute the application files into them. This will help us to manage our application in a better way.

(more…)

ASP.NET Core Routing Generating URLs

Last Updated: April 29, 2022

aspnet core generate url routing

The concept of Routing is very vast and I have covered it in 6 tutorials which are:

So make sure you cover each of these one by one.

(more…)

ASP.NET Core Attribute Routing

Last Updated: April 29, 2022

attribute routing aspnet core

ASP.NET Core Attribute Routing adds routes by applying C# attributes on the controller and actions methods. Note that if convention routes are also present then we can override them by adding attribute routes. This is because DOT NET gives preference to attribute routes.

(more…)

Learn ASP.NET Core Route Constraint in details with lots of examples

Last Updated: April 29, 2022

constraining-routes-aspnet-core

ASP.NET Core Routing Constraints restricts route matching to a set of URLs. This is done by applying different types of constraints or rules in the route patterns.

Let’s start understanding this topic by creating a simple example project.

(more…)

Learn ASP.NET Core Convention-Based Routing

Last Updated: April 29, 2022

url routing aspnet core

What is ASP.NET Core routing? Routing is used to create URL patterns for a web app. These route patterns match the incoming HTTP requests and dispatches these requests to the endpoints in the app. Endpoints are those units that are responsible for handling these requests. Most commonly endpoints are the Controllers in an ASP.NET Core MVC app.

In the Program.cs class we can define one or more ASP.NET Core Routes to perform the following tasks:

(more…)

Views in ASP.NET Core

Last Updated: April 17, 2022

aspnet core views

ASP.NET Core Views create the UI for the app. Views are files with .cshtml extension. A View file contains HTML and Razor markups for creating the design for the UI. Views can be 3 main types:

  1. Views preciously for single Action methods
  2. Shared Views - that are shared between different controllers.
  3. Layouts - to provide consistent design for the app.
  4. Partial views - to reduce code duplication.
  5. View components - to reduce code duplication and also allow code to run on the server for rendering the webpage.
In this tutorial I will continue on the same project which I created on Actions in ASP.NET Core tutorial. However you can still understand all the topics covered here even if you haven't read the previous tutorial.
(more…)

jQuery toggleClass Method – .toggleClass() Tutorial

Last Updated: June 3, 2021

jquery toggleclass

If you want to toggle between adding and removing classes from selected elements then use the jQuery toggleClass method.

Note that if an element does not have a particular class then this method will add that class to the element.

(more…)

Actions in ASP.NET Core

Last Updated: September 30, 2025

actions aspnet core

ASP.NET Core Action Methods are public methods defined inside the Controllers. These methods are mapped to incoming requests made from the client through routing rules.

(more…)

Controllers in ASP.NET Core

Last Updated: April 8, 2022

controllers aspnet core

Controllers are the brain of an ASP.NET Core application. They process incoming requests, perform operations on data provided through Models, and selects Views to render on the browser. Controllers are stored inside the Controllers folder in the root of the app. They are basically C# classes whose Public methods are called as Action Methods. These Action Methods handle the HTTP requests and prepare the response to be sent to the clients.

(more…)