How to Redirect a Request in ASP.NET Core MVC

ASP.NET Core is a cross-platform, open source, lean, fast, and modular framework for building high-performance web applications. ASP.NET Core MVC applications enable you to redirect a request to a specified URL in several different ways. This article talks about how we can accomplish this with code examples wherever appropriate. To work with the code examples […]

Read more
How to Host ASP.NET Core in Window Service

Did you know that we can host ASP.NET service on Windows with Windows Service without using IIS? The benefit of hosting on Windows Service is that the application will automatically restart after the server reboot. This functionality is implemented using a Worker Service Template that becomes the initial point for writing and building long-running service […]

Read more
How to Use Entity Framework Connect to SQL Server

This post shows goes through the steps to connect a .NET 6 API to SQL Server using Entity Framework Core, and automatically create/update the SQL Server database from code using EF Core migrations. We’ll start with an example .NET 6 CRUD API from a tutorial I posted recently, it uses the EF Core InMemory db […]

Read more
How to Handle Exceptions, Validations in ASP.NET Core Web API

This post looks at the best ways to handle exceptions, validation and other invalid requests such as 404s in ASP.NET Core Web API projects and how these approaches differ from MVC error handling. Why do we need a different approach from MVC? In .Net Core, MVC and Web API have been combined so you now […]

Read more
How to Use NSwag to Generate Vue Client ASP.NET Core 3.1

In this post, we are going to learn how to add a Vue project that will utilize the contacts API we created a few weeks ago using a client-generated by NSwag. This post is part of the revamp of the ASP.NET Core Basics repo that was kicked off when .NET Core 3.0 was released which is now […]

Read more
Know Further About IServiceProvider ASP.NET Core

If you’ve built applications using ASP.NET Core then you’ve most likely used the built-in dependency injection container from Microsoft.Extensions.DependencyInjection. This package provides an implementation of the corresponding abstractions found in Microsoft.Extensions.DependencyInjection.Abstractions. In the previous post, we learned about the IServiceCollection, including how service registrations are converted to ServiceDescriptors and added to the collection. We’ll continue learning about ASP.NET […]

Read more
10 Things You Need to Know About ASP.NET Core Memory Caching

The primary purpose of any caching mechanism is to improve performance of an application. As an ASP.NET developer you are probably aware that ASP.NET web forms as well as ASP.NET MVC could used Cache object to cache application data. This was often called server side data caching and was available as an inbuilt feature of […]

Read more
How to Create Entity Core Migrations for SQLite and SQL Server

In this post we’ll go through an example of how to setup an ASP.NET Core project with EF Core DB Contexts and Migrations that support multiple different database providers. The below steps show how to use a SQLite database in development and a SQL Server database in production, but you could switch these to any […]

Read more
Know Further About ModelState in ASP.NET 5.0

In this post, we’re going to explain what the ModelState is, and what it is used for. We’ll also show how to use it to validate our POSTed inputs, and do simple custom validation. Here we go! What is the ModelState? In short, the ModelState is a collection of name and value pairs that are submitted to the server […]

Read more