blog post image
Andrew Lock avatar

Andrew Lock

~9 min read

ASP.NET Core in Action, Third Edition is now in print

I'm excited to announce that my new book, ASP.NET Core in Action, Third Edition is now available in print! You can buy it from

Two copies of ASP.NET Core in Action, Third Edition on a table

As always, I underestimated the changes I wanted to make in this edition, but I'm really happy with how it turned out in the end, and I hope you will be too!

If you have already purchased the MEAP as pBook, your copy should ship shortly. Note that shipping may be delayed for locations outside the USA.

What's more, you can currently get 45% off at manning.com with the code pblock3 only until August 17th, so if you're considering purchasing it, now is the time to grab it!

In this post, I give an overview of the topics covered in the book, and highlight some of the major changes from the second edition to the third edition.

How can I read it?

ASP.NET Core in Action is available in several formats:

  • Print—a chunky paperback, currently available from Manning and Amazon
  • e-book—multiple different e-book formats are available. You can purchase for Kindle from Amazon, or for kindle, epub, or pdf from Manning.com. Some formats take a little longer to become available, so be sure to check the store for dates when you're buying!
  • Livebook—Manning also make books available on their Livebook platform. Here you can read directly in your browser, leave comments and highlights, ask questions, and quickly copy code. And new features are being added all the time!

The Manning Livebook interface

Every chapter includes code samples and examples, introducing each concept in isolation, and showing how it fits in to the big picture. You can find the full code of sample projects on GitHub at https://github.com/andrewlock/asp-dot-net-core-in-action-3e. The samples for each chapter live in a single folder, which contains a solution file, so you can load the samples for one chapter at a time. Alternatively, you can open the solution file in the root directory and load everything at once!

In contrast to some books, ASP.NET Core in Action, Third Edition doesn't create a single project that builds up throughout the book. Instead it primarily uses simple projects that demonstrate a single feature at a time. There are advantages to both approaches, and I have taken a middle-ground in this book. As we get towards the end of the book you will see some samples gaining extra features like authentication and authorisation. I hope this strikes the right balance of being easy to learn while demonstrating how things work in practice.

What does it cover?

ASP.NET Core in Action, Third Edition has been fully updated to .NET 7, including updating to the new WebApplication and WebApplicationBuilder pattern and everything that entails! This was a big part of the update, updating all the code samples and replacing the Startup/Program.cs based code with top-level programs.

If for some reason you don't like the WebApplication approach, chapter 30 describes how to use a custom HostBuilder instance, how to separate your configuration into a Startup class, and how to take a middle-road between the two.

The big additions in the third edition of the book centre around minimal APIs. Minimal APIs provide a great introduction to ASP.NET Core, as there's fewer concepts to grasp when you're first getting started. That said, they have a surprising depth to them once you add model building, route groups, and filters.

For this reason, I chose to restructure the first half of the book around minimal APIs. Part 1 focuses on the basics of ASP.NET Core and building minimal API applications. By starting with minimal APIs, you can build applications fast, without worrying about the extra conventions introduced by MVC or the Razor syntax required for Razor Pages. That also enabled me to introduce topics like dependency injection and configuration earlier than in the previous edition.

Even though I focus on minimal APIs initially, you'll still learn about Razor Pages in depth in Part 3. I cover how to build page based applications using Razor Pages, the Razor syntax, and why I favour Razor Pages over MVC controllers in most situations these days.

I don't cover Blazor in this book. Instead I recommend Blazor in Action by Chris Sainty.

Part 4 of the book focuses on important concepts such as authentication, authorization, logging, and security. Given the early focus on minimal APIs, this edition of the book also includes a chapter on API security specifically, looking at common specifications like OAuth and OpenID Connect. Both of these topics are books in their own right, so this chapter aims to give you a feeling for how they work and why you might want to use them.

Using OAuth 2.0 to authorize dogphotos.com to access your photos on Facebook
Using OAuth 2.0 to authorize dogphotos.com to access your photos on Facebook. From ASP.NET Core in Action, Third Edition.

In part 5, I cover a variety of topics, such as building custom components, creating headless/background services using the generic host, and testing your application. By the time you reach the end of the book you will have covered a wide range of ASP.NET Core application types, how to test them, and how to build them. Everything you need to get started building in the real world!

What is in each chapter?

I've given a brief overview of the book, but in this section I'll go into more detail about the learning path through the book. If you're on the fence, or not sure whether a topic is covered, hopefully this will clear things up! 🙂

Part 1 provides a general introduction to ASP.NET Core, focusing on building small JSON APIs by using the latest features introduced in .NET 7. After we cover the basics, we look at building minimal API applications that provide the simplest programming model for ASP.NET Core web applications.

  • Chapter 1 introduces ASP.NET Core and its place in the web development landscape. It describes the type of applications you can build, some of the reasons to choose ASP.NET Core, and the basics of web requests in an ASP.NET Core application.
  • Chapter 2 looks at why you should consider using any web framework, why ASP.NET Core was created, and the different application paradigms you can use with ASP.NET Core. Finally, it looks at the situations when you should and shouldn’t choose ASP.NET Core.
  • Chapter 3 walks through all the components of a basic ASP.NET Core minimal API application, discussing their role and how they combine to generate a response to a web request.
  • Chapter 4 describes the middleware pipeline, the main application pipeline in ASP.NET Core, which defines how incoming requests are processed and how a response should be generated.
  • Chapter 5 shows how to use minimal API endpoints to create a JavaScript Object Notation (JSON) HTTP API that can be called by client-side apps, server-side apps, or mobile devices.
  • Chapter 6 describes the ASP.NET Core routing system. Routing is the process of mapping incoming request URLs to a specific handler method, which executes to generate a response.
  • Chapter 7 looks at model binding in minimal APIs, the process of mapping form data and URL parameters passed in a request to concrete C# objects.

Part 2 covers important topics for building fully-featured web applications after you understand the basics:

  • Chapter 8 introduces the concept of dependency injection (DI) and describes the DI container built into ASP.NET Core.
  • Chapter 9 builds on chapter 8 by describing how to register your own services with the DI container, the patterns you can use, and how to understand the lifetime of services the DI container creates.
  • Chapter 10 discusses how to read settings and secrets in ASP.NET Core, and how to map them to strongly typed objects.
  • Chapter 11 describes how to document your APIs using the OpenAPI standard and how this helps with testing scenarios and for automatically generating clients to call your APIs.
  • Chapter 12 introduces Entity Framework Core (EF Core) for saving data in a relational database.

Part 3 moves away from minimal APIs and looks at how to build server-rendered page-based HTML applications using Razor Pages and the Model-View-Controller (MVC) architecture:

  • Chapter 13 shows how to use Razor Pages to build page-based web sites. Razor Pages are the recommended way to build server-rendered applications in ASP.NET Core and are designed for page-based applications.
  • Chapter 14 describes the Razor Pages routing system and how it differs from minimal APIs.
  • Chapter 15 looks at page handlers in Razor Pages, which are responsible for choosing how to respond to a request and selecting what response to generate.
  • Chapter 16 looks at model binding in Razor Pages, how it differs from minimal APIs, and the importance of validating your models.
  • Chapter 17 shows how to generate HTML web pages using the Razor template language.
  • Chapter 18 builds on chapter 17 by introducing Tag Helpers, which can greatly reduce the amount of code required to build forms and web pages.
  • Chapter 19 introduces MVC controllers as an alternative approach to building both server-rendered HTML applications and API applications.
  • Chapter 20 describes how to use MVC controllers to build APIs that can be called by client-side apps as an alternative to minimal APIs.
  • Chapter 21 introduces the MVC and Razor Pages filter pipeline, shows how it works, and describes some of the filters built into the framework.
  • Chapter 22 builds on chapter 21 by showing how to create custom filters to reduce some of the duplication in your MVC and Razor Pages applications.

The chapters that make up part 4 cover important cross-cutting aspects of ASP.NET Core development:

  • Chapter 23 describes how to add user profiles and authentication to your application by using ASP.NET Core Identity.
  • Chapter 24 builds on the previous chapter by introducing authorization for users so you can restrict which pages a signed-in user can access.
  • Chapter 25 discusses authentication and authorization for API applications, how this differs from authentication in HTML applications, and how to get started with authentication in ASP.NET Core APIs.
  • Chapter 26 shows how to configure logging in your application and how to write log messages to multiple locations.
  • Chapter 27 looks at how to publish your app and configure it for a production environment.
  • Chapter 28 discusses the reason for adding HTTPS to your application, how to use HTTPS when developing locally and in production, and how to force HTTPS for your whole application.
  • Chapter 29 explores some other security considerations you should make when developing your application and how to stay safe with ASP.NET Core.

Part 5 looks at various topics that help you take your ASP.NET Core applications further, including non-web applications, custom configuration and components, and testing:

  • Chapter 30 discusses an alternative bootstrapping approach for ASP.NET Core apps, using the generic host and a Startup class.
  • Chapter 31 describes how to build and use a variety of custom components, such as custom middleware, and how to handle complex configuration requirements.
  • Chapter 32 expands on chapter 31, showing how to build custom Razor Page components such as custom Tag Helpers and custom validation attributes.
  • Chapter 33 discusses the IHttpClientFactory service and how to use it to create HttpClient instances or calling remote APIs.
  • Chapter 34 explores the generic IHost abstraction, which you can use to create Windows Services and Linux daemons. You’ll also learn to run tasks in the background of your applications.
  • Chapter 35 shows how to test an ASP.NET Core application with the xUnit testing framework.
  • Chapter 36 follows on from chapter 35, showing how to test ASP.NET Core applications specifically. It covers both unit tests and integration tests using the Test Host.

The two appendices provide supplementary information:

  • Appendix A describes how to configure your development environment, whether you’re in Windows, Linux, or macOS.
  • Appendix B contains links that I’ve found useful in learning about ASP.NET Core.

Summary

To sum up, my new book ASP.NET Core in Action, Third Edition is now available in print! You can buy it from

If you're buying from Manning, don't forget you can currently get 45% off with the code pblock3 only until August 17th. Thanks, and I hope you enjoy it!

Andrew Lock | .Net Escapades
Want an email when
there's new posts?