ASP.NET Core

Overriding ASP.NET Core Framework-Provided Services

You take the red pill—you stay in Wonderland, and I show you how deep the rabbit hole goes

David Pine

4 minute read

Overview In .NET it’s really easy to create your own interfaces and implementations. Likewise, it’s seemingly effortless to register them for dependency injection. But it is not always obvious how to override existing implementations. Let’s discuss various aspects of “dependency injection” and how you can override the “framework-provided services”. As an example, let’s take a recent story on our product backlog for building a security audit of login attempts. The story involved the capture of attempted usernames along with their corresponding IP addresses.

What happened to my Thread.CurrentPrincipal

This is not the IPrincipal you are looking for...

David Pine

4 minute read

Overview Like the title claims, if you’re using ASP.NET Core and expecting the Thread.CurrentPrincipal or ClaimsPrincipal.Current to be populated you’d be wrong. This is not the IPrincipal you’re looking for. In this post we’ll discuss what happened and what you need to do now. Additionally we’ll cover all the peripheral benefits as a result of this change. History If you have ever done any .NET Framework development, you’ve probably seen the Thread class.

ASP.NET Core Response Optimization

Static File Caching & Compression

David Pine

6 minute read

Intro If you’re a web developer, chances are you’re familiar with optimization strategies such as static file caching and response compression. I recently implemented these two concepts in tandem on an ASP.NET Core application that I have been developing… I’m going to share what I have learned. If you haven’t had a chance to use ASP.NET Core yet, you’re missing out! As my friend Scott Addie likes to say: ASP.NET Core is a cafeteria plan in which developers choose application dependencies à la carte.