Tutorials on ASP.NET Core and MVC
This is a collection of tutorials on asp.net and c-sharp languages.
(Rev. 31-Oct-2024)
Categories
|
About
|
|
Jun 2024 (43)
|
May 2024 (14)
|
Mar 2024 (1)
|
» →
Home
» ⟶ here
In this section
The Startup class in ASPNET Core
03 Sep, 2020
This tutorial explains the Startup class in ASP.NET, along with the methods of this class. We also explain how a custom middleware can be attached b . . .
Read ...
ASP.NET Core
C#
Middleware in ASPNET Core
16 Sep, 2020
This tutorial explains everything necessary to get you started with the middleware in ASPNET Core. We explain the built-in middleware components as . . .
Read ...
ASP.NET Core
C#
Exercise on Contact Form with Middleware in ASPNET Core
18 Sep, 2020
Use the concepts learnt till now, and without using razor, and without mvc framework, create a contact form that has a text box (cusName) and a date . . .
Read ...
ASP.NET Core
C#
Routing and Route Templates in ASPNET Core
23 Sep, 2020
This is a summary of the concepts of routing and route templates in asp.net core. We have taken a practical exercise to develop the concepts in an i . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core)How to restrict access ONLY to requests from a specific list of domains and ports only
25 Sep, 2020
Write an ASP.NET Core application such that the route "/home/index/N", where N is any int number, executes only if the website is hosted o . . .
Read ...
ASP.NET Core
C#
Metadata of Endpoints in ASPNET Core
27 Sep, 2020
Some, not all, routes need a daily downtime between 17 hrs to 18 hrs. So they have to be shut during that period so that no requests are processed. . . .
Read ...
ASP.NET Core
C#
(ASP.NET Core AJAX) Ajax based POST of a Razor Page
03 Mar, 2021
How to POST an ASP.NET Core Razor FORM through an Ajax Request. We discuss a practical approach that is to-the-point and easy to understand. The giv . . .
Read ...
ASP.NET Core
C#
(ASP.NET Core) Bare minimum code for a parameterized AJAX GET Request to a C# function
05 Mar, 2021
The following project has a textbox with a send button. The click event fires an AJAX GET request and sends a string parameter to an ASP.NET Core ap . . .
Read ...
ASP.NET Core
C#
(ASP.NET Core) Master Slave Cascading Dropdowns with Ajax
09 Mar, 2021
In nutshell: The selection change event of the master dropdown is used to send the "id" of the selected item to the server, which sends ba . . .
Read ...
ASP.NET Core
C#
(ASP.NET Core Ajax) Admin Panel with Content on the Right
11 Mar, 2021
This project is about creating an Admin Panel that would be suitable for a reporting project or an EBook that shows a table of links on the left and . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core Ajax) Authentication and Authorization with AJAX Requests
16 Mar, 2021
In brief: Just two additions are required to implement AJAX based authorization in your existing ASP.NET Core application - first is on the javascri . . .
Read ...
ASP.NET Core
C#
(solved)Javascript and HTML5 scheme for inplace, inline editing of records
20 Mar, 2021
Pure Javascipt and html5 based general solution for in-place or in-line editing of the tr, td records of an html table. This solution is suitable fo . . .
Read ...
ASP.NET Core
Javascript
(C# ASP.NET Core Ajax) Inline, In-place Edit, Update, Cancel of records without a page refresh
22 Mar, 2021
Simplest explanation of AJAX based Edit, Update, Cancel operations on a row of an HTML table. An ASP.NET Core POST handler receives the updated valu . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core Ajax) How to POST data with AJAX Independently of (i.e., without) a Form and hence solve the HTTP Bad Request Error 400
25 Mar, 2021
Anti-forgery token is NOT available outside of <form> tags. This article, alongwith the appended video, explains how to use IAntiforgery serv . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core) Status of the App_Data folder in ASP.NET Core and what is the way forward?
05 Aug, 2021
Looking for the "protected" App_Data folder in ASP.NET Core? The news is that it doesn't have that status anymore. It is no longer a & . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core) How to use XML as a database in ASP.NET Core
06 Aug, 2021
This is the simplest example of reading and updating a record. For simplicity, the record consists of just one property called Name. An input textbo . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core) Repository Pattern and Dependency Injection with XML as Database
07 Aug, 2021
This is a walkthrough on how to make calls to an XML database via repository pattern and dependency injection. We also give a brief introduction to . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core) Getting Started with Database Connectivity
08 Aug, 2021
Here is a to-the-point tutorial on how database connectivity works in ASP.NET Core. A 3-step roadmap is laid for running your first query to a datab . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core) Getting Started with Database INSERT of Form data
12 Aug, 2021
A form of only one input textbox is POSTed and the data is inserted into a sqlite database. This is a six step walkthrough that starts from creating . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core) Reading, Writing and Deleting Cookies in ASP.NET Core
13 Aug, 2021
We start this walkthrough with a small introduction to the concept of a cookie, and then we explain the various ASP.NET Core snippets to (a) create . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core) Cookie Consent Banner with ITrackingConsentFeature
14 Aug, 2021
This is a walkthrough on how to obtain user consent for usage of cookies on an asp.net core website. This project uses the ITrackingConsentFeature i . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core) _ViewImports file and the do's and don'ts
15 Aug, 2021
_ViewImports.cshtml is shared by all the razor pages in its peer directory, and in the sub-directories below it. It is like an include file, and it . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core) Concept of Areas and an Authorization Scheme
16 Aug, 2021
This is a comprehensive discussion on the need for "areas", and how to practically create "areas", and how, un-like classic MVC, . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core) Razor Components in the Context of Razor Pages Apps
18 Aug, 2021
Razor components are stand-alone, embeddable units that replace themselves with pure HTML, CSS and JS markup. They can accept parameters from the ho . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core) Partial Views from a Practical Perspective
23 Aug, 2021
So this article starts by explaining the various aspects of a partial view from a practical, day-to-day perspective. We have totally removed those p . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core) How to use Session for State Management
24 Aug, 2021
This article explains behind-the-scenes mechanism by which "Session" is implemented in ASP.NET Core. We also enumerate the four extension . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core) Displaying Data and OnGetAsync
26 Aug, 2021
This tutorial continues from where we left the tutorial on INSERT query (see the link below for a recap). The code we discussed there has been exten . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core) Serializing DateTime into Session
27 Aug, 2021
There is no built-in method for storing DateTime into a session variable in ASP.NET Core. However, the Microsoft MSDN docs suggest that developers c . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Deleting Records from a Database with EF Core
31 Aug, 2021
We start by explaining the general scheme for deleting a record from a table. A foreach loop adds an anchor link to each record. The primary key (id . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Editing Records on the same Razor Page with EF Core
03 Sep, 2021
This tutorial discusses the most desired scenario where data entry form and the already existing records are shown on the same page. Each record has . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) When and how to use TempData
04 Sep, 2021
TempData can be used to pass data from one razor page to another. Although QueryString and Session variables can be used to achieve the same objecti . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) CRUD with a Checkbox in a Razor Form
05 Sep, 2021
This tutorial extends the one-textbox FORM that we have implemented for CRUD operations in the previous tutorial (see link below). Now we add a chec . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) CRUD with a Radiobuttonlist in a Razor Form
06 Sep, 2021
This tutorial extends the FORM that we have implemented in the previous tutorial (see link below). Now we add a radiobuttonlist to that form and obs . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) CRUD with a Dropdownlist in a Razor Form
07 Sep, 2021
This tutorial extends the FORM that we have implemented in the previous tutorial (see link below). Now we add a dropdownlist to that form and observ . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Beginner's Introduction to Razor Pages
09 Sep, 2021
This is the simplest introduction to Razor Pages - why you need them, what they are, and how page events and data could be handled with them. See th . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Integrating CSS and JS Files with Razor Pages
11 Sep, 2021
This is a quick and complete explanation of how to integrate your razor pages to a framework such as bootstrap, and how to add and manage your cust . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Inter Page Navigation and Linking of Razor Pages with Anchor Tag Helpers
12 Sep, 2021
Tag helpers provide a standard way of generating html tags in razor pages. They are interpreted on server side. They are of the same syntax as html . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) How to handle a click event in Razor Pages
13 Sep, 2021
An anchor tag helper can be used to specify the name of the click event handler. For this the attribute "asp-page-handler" is set equal to . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Creating an HTML FORM with Razor Pages
14 Sep, 2021
This is an introduction to the most common UI Elements that can be used on a FORM. The article starts with a quick introduction to an html form of o . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) How to handle a FORM submit event
14 Sep, 2021
A form submit is triggerred by a submit button inside FORM tags. If the method is POST, which is most often the case, then the recommended handler i . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) How to handle Server Side Validation
15 Sep, 2021
This article starts with a brief primer on server side validations and why they should be done. A simple model of just one property is used to expla . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Strategy to handle a DbUpdateException
16 Sep, 2021
SaveChanges can fail if a constraint fails, if a connection error occurs or if any generic error occurs. So it should always be wrapped in a try-cat . . .
Read ...
ASP.NET Core
(EF Core) Specifying Primary Key (s) and the DbSet.Find() method
17 Sep, 2021
This is a brief explanation of how to specify single primary key on a model through attributes - but this approach fails when multiple columns are t . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Configuring Role based Authorization
22 Sep, 2021
This is an explanation of how an "Area" based ASP.NET Core project can be configured for role and policy based authorization. Authorizatio . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) SignIn, ReturnUrl and LocalRedirect
22 Sep, 2021
This article starts with an explanation of "SignIn", and then explains the various steps for a signin process. Finally, we discuss what is . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Displaying User Info on each Page he visits
22 Sep, 2021
This is a snippet on showing "You are logged as ..." on every page that an authenticated and authorized user visits. The code can be inser . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) SignOutAsync with Tag Helpers
23 Sep, 2021
Following is a brief scheme on signing out a logged-in user. A function for sign-out is written in the same file as for the login code. Then this fu . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Uploading file(s) and Storing in a Database
28 Sep, 2021
This is a quick and clean scheme for uploading files to a server. In the first part we demonstrate how to store them into a database table. And, in . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Downloading file(s) and FileResult
28 Sep, 2021
A file can be downloaded by returning a FileResult. This article explains how a FileResult is created. Finally, a walkthrough is given that shows a . . .
Read ...
ASP.NET Core
(C# ASP.NET Core LINQ) SingleOrDefault, Find, FirstOrDefault, Single and First
01 Oct, 2021
This is an explanation of SingleOrDefault, FirstOrDefault and Find methods from a practical point of view. We have explained when to use which one a . . .
Read ...
ASP.NET Core
(C# ASP.NET Core LINQ) Where, Include and ToList
01 Oct, 2021
This is an explanation of Where, Include and the ToList methods from a practical point of view. We have explained when to use which one and how to u . . .
Read ...
ASP.NET Core
(C# ASP.NET Core LINQ) Direct Execution of SQL Queries and Stored Procedures
01 Oct, 2021
EF Core translates your LINQ expressions into SQL language queries. However, sometimes it is easier, convenient and faster (as determined by testing . . .
Read ...
ASP.NET Core
(C# ASP.NET Core LINQ) How to Sort Records
01 Oct, 2021
A result set can be sorted in ascending as well as descending order. It is even possible to perform a chained sorting by using "ThenBy" an . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Practice Exercises and Questions on Razor Pages
02 Nov, 2021
(LEVEL IS BEGINNERS) Following is a collection of exercises and practice questions that help in cementing the concepts of asp.net core razor pages. . . .
Read ...
ASP.NET Core
Exercises
(C# ASP.NET Core) Practice Exercises and Questions on Basic Event Handling in Razor Pages
02 Nov, 2021
(LEVEL IS BEGINNERS) These are practice questions and exercises on Basic Event Handling in Razor Pages. Solve them and join our course for their sol . . .
Read ...
ASP.NET Core
Exercises
(C# ASP.NET Core) Practice Exercises and Questions on Database Connectivity
09 Nov, 2021
(LEVEL IS BEGINNERS) These are practice questions and exercises on Basic database connectivity in Razor Pages. Solve them and join our course for th . . .
Read ...
ASP.NET Core
Exercises
(C# ASP.NET Core) Practice Exercises and Questions on Modularity
24 Nov, 2021
(LEVEL IS BEGINNERS) These are practice questions and exercises on Modularity in Razor Pages. Solve them and join our course for their solutions.
Read ...
ASP.NET Core
Exercises
(C# ASP.NET Core) Minimal steps to use a Blazor Component in a Razor Page
29 Nov, 2021
Following are the minimal steps needed to run a hello world type of razor component that handles a click event. The component will have to be based . . .
Read ...
ASP.NET Core
(C# EF Core) MySQL Database Connectivity in an ASP.NET Core Razor Page Project
01 Dec, 2021
These are the minimal steps for connecting to a MySQL database server with EF Core. A simple application of one textbox form has been used to demons . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Practice Exercises and Questions on Areas and Partial Views
01 Dec, 2021
(LEVEL IS BEGINNERS) These are practice questions and exercises on Areas and Partial Views in Razor Pages. Solve them and join our course for their . . .
Read ...
ASP.NET Core
Exercises
(C# EF Core) SQL Server Database Connectivity in an ASP.NET Core Razor Page Project
05 Dec, 2021
These are the minimal steps for connecting to a Microsoft SQL Server database with EF Core. A simple application of one textbox form has been used t . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) What is Docker, Dockerfile, DockerImage and Containerization?
06 Dec, 2021
This article is a beginner's introduction to the terminology associated with docker files, docker images and containers. I have kept the explana . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) How to Create a Docker Image with Visual Studio
08 Dec, 2021
This is a walkthrough on creating a docker image with visual studio. We start by creating a simple asp.net core project with sqlite database connect . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) How to run a Docker Image with Docker Desktop
09 Dec, 2021
This is a walkthrough on running a docker image. We start by explaining the commands for listing the docker images on a computer. Then we explain th . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) How to use Docker Volumes to Persist Data
10 Dec, 2021
In the previous tutorial we were able to run an image in a docker container. The docker container provided a RW memory for our project and also for . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) How to Publish a Docker Image to DockerHub Registry with Visual Studio
12 Dec, 2021
This is a walkthrough on uploading a docker image to the docker hub registry. We shall upload the same hellodocker project and then verify the uploa . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) How to Pull and run MS SQL Server Image in Docker Desktop
13 Dec, 2021
In this tutorial we shall learn how to pull and run the docker image of Microsoft SQL Server through the Docker Desktop program. In this same tutori . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Connectivity to SQL Server Running in a Docker Container
14 Dec, 2021
In this tutorial we shall learn how to connect an ASP.NET Core application to a SQL Server image that is running inside a docker container. Some dat . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Containerizing our Find a Doctor Project to DockerHub
15 Dec, 2021
In this tutorial we shall first create a docker image of our "Find a Docker" project. After that we shall publish that image to the Docker . . .
Read ...
ASP.NET Core
(EF Core) What are Database Migrations
20 Dec, 2021
In this tutorial we shall learn an introduction to the database migrations. This feature is provided by entity framework core through its command li . . .
Read ...
ASP.NET Core
(EF Core) Configuring Visual Studio for Database Migration
21 Dec, 2021
We shall start by creating a simple asp.net core project. Then we shall add nuget packages for a database such as Microsoft SQL Server. After that w . . .
Read ...
ASP.NET Core
(EF Core) Getting Started with your first EF Core Migration
24 Dec, 2021
In the previous tutorial we added the EF Core migration tools to our project. We shall now run our first migration to create a blank database and it . . .
Read ...
ASP.NET Core
(EF Core) Migration on Alterations to a Model
26 Dec, 2021
A real life project evolves over a period of time. This process necessitates additions and alterations to the model classes - properties are added, . . .
Read ...
ASP.NET Core
(EF Core) SQL Scripts for Migration
27 Dec, 2021
In this tutorial we learn that the recommended strategy for migrations is to migrate through SQL Scripts. We will also learn how to use ef core tool . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Environments in ASP.NET Core
02 Jan, 2022
This tutorial explains about the various environments like Development, Staging and Production. We also explain how to set them by various methods a . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Kestrel, IIS, IISHttpServer and HTTP.sys
05 Jan, 2022
An ASP.NET Core application cannot directly accept requests from the internet. For this it needs a server that can face the internet and help it com . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) The launchSettings.json File and launch Profiles
07 Jan, 2022
We learn about the finer details of launchSettings.json file. This file contains various launch profiles to start an application in various modes - . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Logging in ASP.NET Core
10 Jan, 2022
Logging helps in troubleshooting, it helps in audit, it helps in getting signals of an imminent application crash. This topic explains the terminolo . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) What and Why of the UseDeveloperExceptionPage Middleware
12 Jan, 2022
We shall create an app using visual studio 2022, running .NET 6. The application will artificially throw an un-handled exception. Then we shall veri . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Writing a Custom Exception Page and the UseExceptionHandler middleware
20 Jan, 2022
This tutorial continues our previous tutorial where we learnt that if an application is running under development environment, then ASP.NET Core pro . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Storing and Reading Configuration Key Value Data
20 Jan, 2022
We have seen in the previous tutorials that appSettings json file can be used to configure log levels. But this is not the only use of this file - i . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Using Options Pattern to Read Configuration
21 Jan, 2022
In the previous tutorial we read various properties of an appSettings configuration file. But there is a better method for reading complex propertie . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Collecting the Pre-requisites for Identity based Authentication
24 Jan, 2022
We shall create an identity based project from scratch. Although, visual studio provides a scaffolding for all the various modules, but personally I . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Adding a Login Page to an Identity based Authentication Project
05 Feb, 2022
This tutorial shall continue from the previous tutorial where we have made a basic initialization, and we have also created a database to hold the d . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Adding a Registration Page to an Identity based Authentication Project
08 Feb, 2022
The problem with the built-in registration page provided by ASP.NET Core Identity API is that it contains a lot of tags and bootstrap attributes tha . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Account Verification in an Identity based Authentication Project
10 Feb, 2022
Recall from the previous tutorial that in our program.cs file we have set SignIn.RequireConfirmedAccount = true. This prevents immediate login to a . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Resending an Account Verification EMail in Identity based Authentication
11 Feb, 2022
As soon as a new user registers on a website, an account verification email or an sms is immediately sent to him. But it is possible that a user nev . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Forgot Password functionality in Identity based Authentication
13 Feb, 2022
Very often a user is unable to remember the password that he created for a website. In such circumstances, the forgot password link comes to his res . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Reset Password functionality in Identity based Authentication
16 Feb, 2022
We have seen in the previous tutorial that when a user fills the forgot password form, then he is emailed a link to the reset password page. The lin . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Claim based Authorization with Identity
19 Feb, 2022
In its simplest terms, a claim is a name-value pair used to verify authorization. For example, you may be authorized to access a page if a claim of . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Layout Pages and LoginPartial for Identity
24 Feb, 2022
It is a good idea to show the user name of a logged user in the header of each page of a website. And, if the user is not logged in, then the login . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Sign out functionality in Identity based Authentication
24 Feb, 2022
A sign out link allows a logged user to log out of your website. It is usually shown in the header of a page and close to the name of the logged in . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Account Lockout Functionality in Identity
26 Feb, 2022
You must have seen on various websites that a user account gets locked if the user makes about three unsuccessful login attempts. The exact same fun . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Enabling 2-factor Authentication in Identity
03 Mar, 2022
Two factor authentication gives additional security to a login process. But this type of authentication has to be specifically enabled by a user. Fo . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Login with 2-Factor Authentication
18 Mar, 2022
Consider a user who has enabled 2-factor authentication as explained in the previous tutorial. Such a user is required to authenticate twice before . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Disabling 2-Factor Authentication
26 Mar, 2022
The purpose of this tutorial is to add the functionality that allows a user to disable his 2-factor authentication. For this we shall have to modify . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Getting Started with Web Api
28 Mar, 2022
This tutorial starts with a beginner's introduction to the concept of web api. After that we create a basic structure of a project that will hel . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Minimal GET WebApi with No Parameters
12 Apr, 2022
In this tutorial we shall add a web api that allows us to get all the records of a table. Please do note, however, that such a query is never done i . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Minimal GET WebApi with a Parameter of Numeric Type
13 Apr, 2022
In the previous tutorial we learned how to write a web api that accepts no parameters. We executed it to return all the records of a table. In this . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Minimal GET WebApi to Find a Record by Id
15 Apr, 2022
In this tutorial we shall add a web api of GET type that takes an ID as a parameter and returns a record for that parameter.
Read ...
ASP.NET Core
(C# ASP.NET Core) Using Postman to Run WebApi
16 Apr, 2022
Postman is a software that can be used to easily and conveniently run and execute web api. It can be installed as a desktop application. The softwar . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Minimal POST WebApi for Creating a new Record
18 Apr, 2022
A web api of the POST type is used to create a new record. For example, if we have to create a new record of a doctor, then we have to use a POST ap . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Minimal PUT WebApi for Updating a Record
19 Apr, 2022
An Http PUT request is used to update an existing record. For this, a client has to send the unique id of the record along with the entire updated r . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Minimal DELETE WebApi for Deleting a Record
23 Apr, 2022
An HTTP DELETE request is used for deleting a record. The Server sends a 200 OK response on successful deletion alongwith the item that was deleted. . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Over-Posting in WebApi and a Solution with Data Transfer Object
25 Apr, 2022
We have been working with a model class consisting of three properties - id, Name and Fees. All the three properties have participated and have been . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Preventing Over-Posting of a Collection in a WebApi
25 Apr, 2022
If an API has to return a collection of records, and if we do not want entire objects transmitted, then we can use a Data Transfer Object to return . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) DTO Object as Argument and Return in a WebApi
28 Apr, 2022
This tutorial explains how to modify a POST type of WebApi so that it doesn't over-post data. A POST WebApi receives a data object as a paramete . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Calling a GET WebApi from a C++ WinRT App
29 Apr, 2022
This tutorial explains how a GET web api can be called from a C++ WinRT application. I have chosen WinRT type because it contains a lot many pre-wri . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Calling a POST WebApi from a C++ WinRT App
14 May, 2022
This tutorial explains how a POST web api can be called from a C++ WinRT application. I have created a WinRT console application that connects to, . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) OpenAPI and Swagger for Web API Documentation
15 May, 2022
Swagger makes it easy to document the various Web Api exposed by your project. The summary of your API is maintained in a json based file called ope . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Configuring and Using Swagger to Run WebApi
17 May, 2022
Let us now configure our WebApi project to add support for SwaggerUI. As we told earlier, SwaggerUI is provided by both SwashBuckle and NSwag. We ca . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Call a GET Web API From a C# WPF Application
18 May, 2022
In this tutorial we shall learn how to call the various types of WebApi from a C# WPF application. I have already created a WPF application that obt . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Call a POST Web API From a C# WPF Application
18 May, 2022
This tutorial continues from the previous tutorial. We have discussed most of the parts there. So please go through the previous tutorial for a cont . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Call a PUT and DELETE Web API From a C# WPF Application
24 May, 2022
As you must have already seen in the previous tutorials, we have a WPF application that obtains a list of records from our ASPNET Core web api appli . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Introduction to HttpRepl for Testing Web Api
01 Jun, 2022
Http Repl is a command-line tool for testing web api. This tool targets the ASP.NET Core environment. Let's have a look at a brief introduction . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Connecting HttpRepl to a Web Api Endpoint
01 Jun, 2022
Before we can execute and test any web api, we have to establish a connection between httprepl and our web server. If you are following this chapter . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Testing a GET Web Api with HttpRepl
03 Jun, 2022
Now its time to use httprepl for testing our web api. To begin with, we shall test a GET api. I shall assume that your httprepl is installed and rea . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Testing a POST Web Api with HttpRepl
04 Jun, 2022
In this tutorial we shall test a POST Web Api - and create a new record. So we shall have to first establish a connection between httprepl and our w . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Using a static class for Route Handlers in a Minimal WebApi
17 Jun, 2022
So far, we have been writing all our minimal web api in the program.cs file. But this can become un-manageable and un-readable in a full blown proje . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) [FromQuery] Parameter Binding of a QueryString Variable
22 Jun, 2022
We have been obtaining our web api parameters from route templates. A route is not the only source of parameters - in fact the parameters can be obt . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) [FromHeader] Parameter Binding of a Request Header
24 Jun, 2022
Parameters of a web api can be obtained from the values in a request header also. For this an attribute called "FromHeader" is used to dec . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Special Types of Implicit Parameter Bindings
25 Jun, 2022
ASP.NET Core provides certain "special" parameters that are always available to an api handler. These parameters are "utility" p . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Customized Binding of API Parameters
27 Jun, 2022
Consider a web api that extracts parameters x, y and z from its query string and then uses these values to construct a Point object, say for example . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) BindAsync for Customized Binding of WebApi Parameters
10 Jul, 2022
BindAsync is a second method for custom binding of parameters. The first one - TryParse - is good for cases where the items are available in a singl . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) File Upload with a WebApi
15 Jul, 2022
In this tutorial we examine how to write a web api that accepts an uploaded file and saves it to a server. We shall also present a C# console applic . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Basic Authentication in WebApi
23 Jul, 2022
Basic Authentication is not encourged by ASP.NET Core because login id and password are sent as plain text in the request header - it's vulnerab . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) HandleAuthenticateAsync and Basic Authentication in WebApi
25 Jul, 2022
The recommended way of implementing a custom authentication scheme is by deriving a class from AuthenticationHandler and implementing the HandleAuth . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) JWT Authentication in WebApi
26 Jul, 2022
JWT stands for JSON Web Token. In its simplest form, JWT authentication is a two step process. First a client obtains a JWT token from the server. T . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) C# Console App Connectivity for Basic and JWT Authentication
30 Jul, 2022
In this tutorial we present a C# console application that connects to the web api that we have done in the previous tutorial. This app will first ob . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Creating a Google OAuth App for Authentication
02 Aug, 2022
Social media based authentication requires us to create an oauth app on a social media platform such as google, facebook, twitter, github. This app . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Social Media based Authentication, Remember Me and Signout
03 Aug, 2022
Social media based login provides a neat and user-friendly means of logging into your website. Users are more likely to trust this method because of . . .
Read ...
ASP.NET Core
(WebApi C# ASP.NET Core) Social Media Authentication in WebApi
05 Aug, 2022
WebApi can be protected through social media authentication also. The first step is to obtain a client id and a client secret by creating an app on . . .
Read ...
ASP.NET Core
(CORS C# ASP.NET Core) How Cross Origin requests (CORS) fail - example with ajax javascript
11 Aug, 2022
We shall run two ASPNET Core apps concurrently - the first exposes a web API, whereas the other shows a web page containing two links - the first of . . .
Read ...
ASP.NET Core
(CORS C# ASP.NET Core) Why cross-origin requests (CORS) fail and why they succeed?
12 Aug, 2022
In the previous tutorial, we demonstrated how a browser blocks cross-origin calls. So you must surely be wondering why cross-origin requests to CDN- . . .
Read ...
ASP.NET Core
(CORS C# ASP.NET Core) Enabling CORS with a Policy
16 Aug, 2022
An ASPNET Core application can permit cross-origin requests by adding "Access-Control-Allow-Origin" header to the HTTP response. Cross-ori . . .
Read ...
ASP.NET Core
(CORS C# ASP.NET Core) Enabling CORS for Specific CSS or JS Files
18 Aug, 2022
Static files are NOT accessible cross-origin if we call UseStaticFiles before UseCors. But if we reverse the order, every static file becomes access . . .
Read ...
ASP.NET Core
(CORS C# ASP.NET Core) Primer on CORS Preflight Requests
21 Aug, 2022
Browsers consider some cross-origin requests as unsafe. For example, an HTTP PUT request is considered unsafe. A browser first queries the server if . . .
Read ...
ASP.NET Core
(CORS C# ASP.NET Core) Configuring CORS Preflight Policy
22 Aug, 2022
In this tutorial, we learn how to set a CORS policy that will respond to a pre-flight OPTIONS request. This policy will specify the list of acceptab . . .
Read ...
ASP.NET Core
(CORS C# ASP.NET Core) Credential Cookies with Cross-Origin Requests
24 Aug, 2022
By default, a browser doesn't send authentication cookies with cross-origin requests. It sends cookies only if the javascript code sets a proper . . .
Read ...
ASP.NET Core
(CORS C# ASP.NET Core) Practical Verification of Credential Cookies
25 Aug, 2022
In this tutorial, we have two applications - the first is an ASPNET Core application that implements a CORS policy to accept cookies from the second . . .
Read ...
ASP.NET Core
(EFCore Best Practices) Set a SQL Server Project
19 Sep, 2022
In this tutorial we shall set a project to use SQL Server as our database. You can obtain this project from the downloads attached to this video. Bu . . .
Read ...
ASP.NET Core
(EFCore Best Practices) Identify Slow Commands with Logging and Tags
19 Sep, 2022
EF Core provides logs that help us determine the time taken by a specific query to finish. The logs also display the actual SQL query that was execu . . .
Read ...
ASP.NET Core
(EFCore Best Practices) Comparison of Select, Projection, Tracking and Execution in Database
20 Sep, 2022
We shall use various methods to calulate the sum of prices of all the records in the items table. We will also take note of the times taken. Usually . . .
Read ...
ASP.NET Core
(EFCore Best Practices) Lazy Loading and the n+1 problem
23 Sep, 2022
Lazy loading is a great O/RM pattern that AUTOMATICALLY loads dependent (child) data when it is first accessed. The delayed loading is both an advan . . .
Read ...
ASP.NET Core
(EFCore Best Practices) Buffering and Streaming of Resultset
23 Sep, 2022
A query can first store the entire resultset into memory, and then use a foreach loop to process each item. Alternatively, it can stream each result . . .
Read ...
ASP.NET Core
(EFCore Best Practices) Raw SQL with FromSqlRaw for Efficiency
24 Sep, 2022
Suppose your database team have already provided you an optimized query in SQL syntax. Or let's say you have a legacy, old setup that makes it c . . .
Read ...
ASP.NET Core
(EFCore Best Practices) Stored Procedures and Secure Parameterization to Prevent SQL Injection attacks
26 Sep, 2022
Raw SQL queries and Stored Procedures can be executed with the FromSqlRaw extension. It is very common that these queries and procedures require par . . .
Read ...
ASP.NET Core
(EFCore Best Practices) Batching in EF Core and Planning your Bulk Updates
27 Sep, 2022
EF Core uses batching to execute bulk updates in a single trip to the database. You can always fine-tune your code by carefully sequencing your stat . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Program Example on Data Display and FORM Update
01 Nov, 2022
(LEVEL IS BEGINNERS) Suppose there is a model called StudentData with properties ID, Name, School and Marks. Also suppose we already have a collecti . . .
Read ...
ASP.NET Core
Exercises
C# ASP.NET Core Projects with Step-by-Step Explanation and SOURCE CODE
15 Dec, 2022
Get ALL these ASP.NET Core Projects with Source Code + step-by-step Video Explanation in $40 [INR Rs. 3200]. A few to name - "Find a Doctor&quo . . .
Read ...
ASP.NET Core
C#
(C# ASP.NET Core) Billing, Inventory and Shopping with BarCodes ASP.NET Core Project
09 Feb, 2023
Customers visit a retail store and use their mobile phone camera to scan barcodes to add items to their shopping cart. The shopping cart is held in . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Location Tracking Project in ASP.NET Core and .NET MAUI
10 Feb, 2023
This ASP.NET Core Project is a proof of concept that allows a user to keep a record of the locations that an android phone travels. The user has to . . .
Read ...
ASP.NET Core
(ESP32 WROOM) Internet Of Things IOT based Switching
02 Mar, 2023
This ASP.NET Core Project is a proof of concept that allows us to control electrical switches in a building, or if it is extended, then it can be us . . .
Read ...
ASP.NET Core
(C# ASP.NET Core) Realtime Auction with SignalR, WebApi and pure Javascript
14 Apr, 2023
This ASP.NET Core WebApi Project doesn't contain any razor pages. It has been written with a few minimal web api - a client browser connects to . . .
Read ...
ASP.NET Core
(ASPNET Core Exercises) Practice Exercises on CORS in ASPNET Core
24 Jun, 2023
This is a collection of exercises on CORS in ASPNET Core. Solutions have been provided for almost all of them.
Read ...
ASP.NET Core
(ASPNET Core Exercises) Practice Exercises on Web Api in ASPNET Core
28 Jun, 2023
This is a collection of exercises on Web Api in ASPNET Core. Solutions have been provided for almost all of them.
Read ...
ASP.NET Core
(ASPNET Core Exercises) Practice Exercises on Identity in ASPNET Core
04 Jul, 2023
This is a collection of exercises on Identity in ASPNET Core. Solutions have been provided for almost all of them.
Read ...
ASP.NET Core
(C# ASP.NET Core) Cinema Ticket Booking Application
19 Mar, 2024
This ASP.NET Core Project has been written with razor pages, SQLite database and Identity. It's an application for online booking of tickets of . . .
Read ...
ASP.NET Core