Skip to main content
Software Alchemy

The Art and Science of Software Development

Global Exception Handling in ASP.NET Core and Angular

In this blog entry I’ll go over using custom ASP.NET Core middleware to catch various kinds of exceptions so that we can return the proper HTTP status code to the user’s browser. At the Angular side we’ll take advantage of these status codes in order to direct the user to the appropriate pages on an error—an "unauthorized" page or general error page—or simply display a notification. This is one approach to handling server exceptions which are prone to "bubble up" from lower layers of the stack, such as the Application and Domain layers, and elegantly updating the UI.

Authentication and Identity

In this entry, we’ll start to add in more structural elements, namely the authentication components of the UI and Identity Model classes in our Web API. Fortunately, ASP.NET Core and Visual Studio do a lot of this work for us via scaffolding tools. Our main concern is to take this auto-generated code, modify it where needed, and move it into the appropriate layers of our Clean Architecture solution, namely the Infrastructure and Presentation layers.

Architectural Template

This is the first in a multi-part series in which I will be building off the Foundational Concepts Series. My objective is to present actual, procedural steps that you can follow and apply to your own web projects using ASP.NET Core. As I present these steps, I will be updating the demo application accordingly, the goal being to evolve it into a working web application by the end of this series.

My objective is to demonstrate that Clean Domain-Driven Design works in modern web applications built on the ASP.NET Core stack. The desired end-product will be a multi-tenant SaaS product which can scale to accommodate complex business logic. I intend to revisit different areas of functionality in future blog series’, at which point we can make it more robust and enterprise worthy.

Architectural Template

This is an architectural template for building web applications which is based upon my interpretation of the Clean DDD and CQRS concepts that I introduced in the previous entry. To demonstrate this, I've created a demo application which attempts to solve a fictional problem for a fake organization. In developing this template, I studied solutions and tutorials from a handful of experts.

So you want to be a Microsoft (.NET) stack developer? Your head may be spinning from all the information out there and recommendations that you've either heard from other people or read online (e.g. Reddit). You might be feeling like you're being pulled in several directions.

I'd like to help you.

The purpose of this blog series, the Foundational Concepts Series, is to help introduce novice software developers to programming on the Microsoft stack. I first started coding when I was a kid and I've been using C# and .NET since 2003, so I'd like to think that I've learned a few things over the years. Even intermediate or advanced software developers may learn something new or fill in gaps in their knowledge from this blog series. My goal is to present the material in a fun and accessible format, so that the reader is left with not only a greater understanding of programming concepts and how to create quality software using one of the finest ecosystems out there, but also a passion for learning, so that you will continue to grow as a professional and as a person.