Hardening ASP.NET Response Headers (Code)
A reliable way to harden your ASP.NET web application is to remove and skew the response headers via code. This will throw off automated scans that are performing banner grabbing in an attempt to identify vulnerabilities. There are ways to do this in IIS, however, performing this in code means it's applied everywhere that the...
.NET: Unit Testing Azure Service Bus
Unit testing an Azure Service Bus consumer is fairly easy. In this tutorial, I will use .NET6, Moq (v4), and Fluent Assertions. The difficult part is constructing the ServiceBusMessageReceived because it has only internal constructors and no interface. However, there is a factory service that can create these objects.
GitHub
I've included unit testing in this...
Repository Pattern (C#)
There are some really good articles out there about the repository pattern but I haven't seen one that strongly demonstrates different data providers, sample code, or some of the tricks I've learned. I primarily build internal business applications so I've used this pattern at almost every .NET job I've ever had. It's very common and I've learned...
Docker: Jenkins Build Server on Windows Server Core
Big fan of Jenkins! I've really enjoyed the flexibility that this CI server provides. While it's easy to run a Linux container with Jenkins and do .NET Core builds it's not possible to build traditional ASP.NET projects... unless you install Mono.. but I could never get that to work. After contemplating my...
.NET Kafka Producers
This multipage post will specifically target the concept of getting data out of a specific system or database and on to the Kafka Event Bus. There are many ways of doing this and some are easier to implement than others. It's important to remember why Kafka is relevant in today's world; Kafka is a real-time event streaming...
Local Development with Azure API Management Gateway
This was rather tricky to figure out so I thought I would share my experience with setting up Visual Studio with a local development subscription of Azure API Management (APIM) Gateway. It turns out that running a local copy of the Azure API Management Gateway is possible through either Docker or Kubernetes. Since...
.NET Core: Dynamically Return Style Sheets with Web API
If you have a need to dynamically return a stylesheet to the UI here's a quick tutorial on how to do it.
Header Template
C# Web API
Identity Server 4 ClientCredentials with POSTMAN
This tutorial will demonstrate how to set up security within microservices using Identity Server 4 with OpenID. This will use a Client and Secret for microservice to microservice (machine-to-machine) communication that way a compromised microservice can't interact with resources it's not authorized to. I will also demonstrate how to use POSTMAN to get tokens,...
TypeScript Experimental Decorator Error in Visual Studio/Code
I ran into this issue in Visual Studio 2019 while working on a .NET Core/Angular 8 project. It seems like every new component I created displayed an error or a warning for experimental decorators. After doing a bunch of research this issue seems more prominent in Visual Studio Code so I thought I...