ASP.NET Core Tutorial

This ASP.NET Core tutorial will teach you the basics of building an ASP.NET Core MVC web application using Visual Studio 2017.  ASP.NET Core is the new web app framework from Microsoft. Going forward ASP.NET Core is going to replace the Current ASP.NET Framework.

This Tutorial has been updated to cover ASP.NET Core 2.0


ASP.NET Core is a collection of libraries that form a framework for building web applications.  It is not the upgrade of the current ASP.NET Framework. It is the brand new version written from scratch. It has a number of architectural changes that result in a much leaner and modular framework.

At the end of this ASP.NET Core tutorial, you will learn everything you need to start using ASP.NET Core. We will be starting from the basics by building a simple application and continue from there to the advanced topics


This tutorial is designed for software programmers who would like to learn the basics of ASP.NET Core from scratch.


Good knowledge of C# programming is must to continue with this ASP.NET Core Tutorial. The knowledge of the earlier version of ASP.NET is helpful, but not necessary. Basic knowledge of HTML, CSS and Visual Studio IDE is also required

ASP.NET Core Tutorial

Getting Started with ASP.NET Core

1. Introduction to ASP.NET Core

This article tutorial gives a brief introduction to ASP.NET Core. The ASP.NET Core is a new framework built with the aim of cross-platform portability. It can run on .NET Core or .NET Framework.

2. Installing and setting ASP.NET  Core Development Environment 
3. Download .Net Core

In this tutorial, let us look at how to set up an ASP.NET Core development environment so that you can get ahead with the developing the solutions with ASP.NET Core. We look at how to install or upgrade Visual studio 2017. Install Latest Dot Net Core SDK etc.

4. Dotnet CLI: Command-line tools for ASP.NET Core 

The dotnet CLI is a command-line interface (CLI) is a new tool for developing the .NET application. It is a cross-platform tool and can be used in Windows, MAC or Linux. In this tutorial, we will learn how to use .NET Cli create a simple ASP.NET Core application

5. Getting Started with ASP.NET Core Hello World Example.

In this tutorial, we get started by building an ASP.NET Core Hello World example application. We will use Visual Studio 2017 as our editor. The application will use the default empty template, which displays “Hello World”. Before getting started, you must install the .NET Core SDK and Visual Studio 2017 Community Edition. We also learn how to build and run the Hello World App using the dotnet command-line utility.

ASP.NET Core Fundamentals

1. ASP.NET Core Solution / Project Structure  

In this chapter, we will learn how ASP.NET Core solution items are organized in the Visual Studio and on the file system.

2. Program Class
3. Startup Class

In this article, we will look at the startup.cs and program.cs in more detail. The program class creates a web server in its Main method, while the startup class configures services and the application’s request pipeline.

3. Kestrel: Web server for ASP.NET Core 

In this tutorial, let us look at the Kestrel Web Server for ASP.NET Core. The way we host our application in ASP.NET Core has gone through some drastic change compared to the previous version of ASP.NET. The Kestrel is the new way to Host to ASP.NET Core Application. It runs within the application process making it completely self-contained.

4. Middleware and Request Pipeline 

In this, article, we will learn what is Middleware is and how the Request Pipeline works in ASP.NET Core application. Request PipeLine The Request Pipeline is the mechanism by which requests are processed beginning with a Request and ending with a Response. The pipeline specifies how the application should respond to an HTTP request. 

5.  Serving Static Files in ASP.NET Core 

In this article, we will learn how to Serve Static files in ASP.NET Core. The ASP.NET Core has the ability to serve the static files such as HTML, CSS, image, and JavaScript directly to clients, without going through the MVC Middleware

MVC Design Pattern

1.  MVC Design Pattern 

ASP.NET Core web apps are based on the popular MVC Design pattern. MVC Pattern stands for Model-View-Controller Pattern. In this tutorial, we learn what is MVC and in the subsequent tutorial, we will see how to use MVC Design pattern in ASP.NET Core.

2.  Building the First ASP.NET Core App 

In this tutorial, let us learn how to build an ASP.NET core MVC app from scratch using Visual Studio. In the last article, we learnt what is MVC Design Pattern is and how it works in ASP.NET MVC Core applications. We continue to explore the MVC architecture and show you how to add the MVC Middleware to the App. Then we will show you how to add Controller, View and a Model to the ASP.NET MVC Core App.


1.  Controllers Basics 

In this tutorial. We will introduce to you to the basic concepts of ASP.NET Core controllers. We will look at the controller action method and the return type from the Controller Action i.e Action Results.

2. ASP.NET Core Endpoint Routing  

One of the most important parts of the MVC Architecture is the Endpoint Routing Module introduced in 3.0. It is the Endpoint Routing Middleware’s that decides to invoke the controller for a particular request. For Version before version 2.0 or before check the article Routing in ASP.NET Core 2.0

3. Convention based Routing

4. Attribute Routing in ASP.NET Core 

In this article, we will look at the Attribute Routing in ASP.NET Core Apps. We learned the basics of Routing in the last tutorial. Routing is how ASP.NET Core matches an incoming URL to a controller action.

5.  Route Constraints 

The Route Constraints helps us to filter out or restrict the unwanted values from reaching the controller action. It does so by checking the Constraint against the value of the URL Parameter. For Example, you would want to Route engine to match a particular route only if an integer value is supplied for an URL parameter.

6.  Action Selectors & Action Verbs 

In this article, we look at what is Action selector and its role in selecting the controller action methods. In the last few tutorials on Routing in ASP.NET Core, We learned how routing engine picks up the correct action method to execute when the request arrives. The Action selectors i. e. Action Name, Non-Action and Action Verbs gives us more control in the URL Matching Process.

7.  Action Results 

In this tutorial, we will explore how to create a formatted response to Controller Action methods. The ASP.NET Core provides several APIs collectively called as Action Results to generate the correctly formatted response, which can be consumed by the Clients. Let us explore what is Action Results are and what are the different types of Action Results that are available to us.


1.  View Basics 

The View is the Component of the MVC design pattern (or architecture), which is responsible for presenting the User interface to the User.

2.  Razor View Engine & Razor Syntax 

In this Razor tutorial, we will take a quick tour of the Razor View Engine in ASP.NET Core MVC. The Razor makes it easier to embed the C# code inside the HTML, thus providing the ability to generate the dynamic response. In this tutorial, we will explore the Razor syntax.

3.  Layouts & Sections 

The Layouts and sections in ASP.NET MVC core help us to maintain a consistent look across all the pages or views of our application. In this tutorial, we will learn how to create a Layout page, which is shared between the views. We will use the Renderbody to render the view. We will also see how to define sections and render it using the RenderSection. Finally, We will take a look at _viewstart to define the layout Page

4.  ViewBag & ViewData 

In this article, we look at what is Action selector and its role in selecting the controller action methods. In the last few tutorials on Routing in ASP.NET Core, We learned how routing engine picks up the correct action method to execute when the request arrives. The Action selectors i. e. Action Name, Non-Action and Action Verbs gives us more control in the URL Matching Process.


1.  Model Basics. Doman Model, ViewModel & Edit Model 

In this article, we will give you a brief introduction to the Model in the ASP.NET Core MVC application. The Model could mean many things depending on what are you trying to do. In the context of ASP.NET Core MVC Apps, the model could be a Domain model, View Model or an Edit Model. We will learn what they are and how and where to use them

2.  Passing Data (ViewModel) from Controller to View 

In this tutorial, we are going to learn how to pass data from Controller to View. We should create View Models with all of the needed data and pass it from the controller to the View. The View Models can be passed to the View by creating a dynamic property in ViewBag. It can be passed using the Model Property of the ViewData. The Model property allows us to create strongly typed Views using the @model directive. We will look at all these in this tutorial.

Building Forms

1.  Building HTML Forms 

In this tutorial, we will build a very basic data entry form using the ASP.NET Core. A form is an HTML form that lets visitors enter the information on the web page. We will build a simple form, which will accept the product details. Then we will see how to receive the form data on our server when the user hits the submit button.

2.  Strongly Typed View 

In the previous tutorial, we saw how to build a simple HTML form. We made use of the ViewModel but did not pass the instance of it to the view. The ViewModel can be passed from the controller to the view either using Viewbag or Viewdata. The ASP.NET Core provides the ability to pass strongly typed models or objects to a view. This approach helps us with the intellisense and better compile-time checking of our code. The scaffolding mechanism in Visual Studio can be used to create the View. Let us learn all these in the article.

3.  Tag Helpers 

Tag Helpers are new features in ASP.NET Core, which help us add the server side code easily into our HTML markup. In this tutorial, we will make use of them to update the HTML form, which we created in the previous tutorial on strongly typed view.

4.  Input Tag Helper 

The Input Tag Helper generates the appropriate <input> HTML element for the model property. The model property is bound using the asp-for attribute. The input tag helper generates the appropriate HTML type, name & id attribute based on the Property data type & data annotations applied to the ViewModel. The ViewModel must be strongly typed to the View. It also emits the Validation related attributes, which helps in unobtrusive client-side validation. The asp-format attributes help in generating the properly formatted input elements.

5.  Label Tag Helper 

The label Tag Helper generates the appropriate <label> HTML element for the model property of our ViewModel. The model property is bound to the model property using the asp-for attribute. In this tutorial, we will learn how to use Label Tag Helper in detail.

6.  Form Tag Helper 

The Form Tag Helper generates the HTML <form> element based on the various attributes like asp-controller, asp-action etc. In this tutorial, We will look at how to use Form Tag Helper in ASP.NET Core forms.

7.  Environment Tag Helpers 

The environment tag helper supports rendering different content depending on the core environment variables set. In this tutorial, we will look at this Tag Helper in more detail

8.  Model Binding 

In this Model binding in ASP.NET Core article, we will learn How to pass data from View to Controller. We learn what is Model binding is and how it works. The ASP.NET core allows us to bind data from various binding sources like HTML Forms using [FromForm], Route Values using [FromRoute], Query string using [FromQuery], Request body using [FromBody] and From Request Header using [FromHeader]. We will look at all these in this chapter

9.  Model Validation

In this tutorial, we look at how ASP.NET core Model Validation works. Often the data entered by the user is not valid and cannot be saved into the database. The entered data may contain a typo or user may intentionally enter the inappropriate data. Hence, we need to validate the user input before storing it in the database. The ASP.NET Core gives us Model Validator, which uses the validation attributes to validate the model, which makes our task easier. We also take a look at ModelState and how to use it. Finally, we look at the list of Validation attributes

10.  Validation Tag Helpers

The ASP.NET provides validation related tag helpers which display the validation messages to the user. We learned how server-side model validation works in the previous tutorial. The Model binder binds and validates the data received over the HTTP Request. It then creates the ModelState object, which contains the validation messages generated by the Model Binder. The Validation Tag helpers generate the HTML element to display these messages in the view.

11.  Client side validation

In the tutorial, we will learn how to perform client-side validation using Javascript. We learnt how to perform server-side model validation in the previous tutorial. The Unobtrusive client- side validation in ASP.NET Cores uses the same validation attribution that used by the Model Validator. We will learn all these in this tutorial.

Dependency Injection

1.  Dependency Injection

Dependency injection has now become the first class citizen in ASP.NET Core. It helps us to build loosely coupled, easily readable and maintainable code. In this tutorial, we will learn the basics of the dependency injection by building a simple application.

2.  Dependency Injection Lifetime: Transient, Singleton & Scoped

Understanding the lifetime of the services created using the Dependency injection is very essential, before starting to using them. Creating services without understanding the difference between Transient, Singleton & Scoped lifetime can result in application behaving erratically. When a service requests another service via DI, knowing whether it receives the new instance or an already created instance is very important. Hence correctly specifying the lifetime while registering the service are utmost important.


The Configuration system has gone through a lot of changes in the new ASP.NET Core. The older ASP.NET used the Web.config file store configuration information. The newer configuration system now provides API to load the configuration from various sources like Json, XML, INI, Command line argument, Environment variables etc. In this tutorial, let us see how to store and retrieve the configuration from the appsettings.json file

  1. ASP.NET Core Configuration 
  2. Reading the Configuration
  3. Environment Variable
  4. launchSettings.json
  5. appSettings.json


  1. Authentication in ASP.NET Core
  2. Cookie Authentication in ASP.NET Core
  3. Introduction to ASP.NET Core Identity
  4. ASP.NET Core Identity Tutorial From Scratch
  5. Sending Email Confirmation in ASP.NET Core
  6. Add Custom Fields to the user in ASP.NET Core Identity
  7. Change Primary key in ASP.NET Core Identity
  8. JWT Authentication in ASP.NET Core


  1. Introduction to Authorization
  2. Simple Authorization using Authorize attribute
  3. Adding & Managing Claims in ASP.NET Core Identity
  4. Claim Based Authorization in ASP.NET Core
  5. Policy-based Authorization
  6. Resource-Based Authorization


  1. AddController vs AddMvc vs AddControllersWithViews vs AddRazorPages

1 thought on “ASP.NET Core Tutorial”

Leave a Reply

Your email address will not be published.

Scroll to Top