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 If you have ever done any .NET Framework development, you’ve probably seen the Thread class. You’re probably familiar with the Thread.CurrentPrincipal member. This member of the Thread class is defined as follows: public static IPrincipal CurrentPrincipal { [System.Security.SecuritySafeCritical] // auto-generated get { lock (CurrentThread) { var principal = (IPrincipal)CallContext.Principal; if (principal == null) { principal = GetDomain().GetThreadPrincipal(); CallContext.Principal = principal; } return principal; } } [System.Security.SecuritySafeCritical] // auto-generated [SecurityPermission(SecurityAction.

Building a Magic Mirror

Windows 10 IoT Core, UWP, C#, Raspberry Pi 3

David Pine

6 minute read

Inspiration I am certainly not the first one to create a magic mirror, and I will not be the last either. I was inspired by those who are true Innovators…some might say, “I’m standing on the shoulders of giants”. They would probably we right, and I’m okay with that. Earlier this year, I stumbled upon a tweet about someone how created a magic mirror…this is the root of my inspiration.