Tag Archives: .NET

Secure your ASP.NET Web API with message handlers.

Message Handlers, commonly known as DelegatingChannels in WCF or DelegatingHandlers in ASP.NET Web API, provide an essential tool for developers to access and manipulate an incoming message prior to that message reaching the HttpControllerDispatcher.

Why would this be useful? Well, you could use a custom message handler for authentication, usage metrics, request logging, the list goes on. I’ll show you an example on basic authentication via simple key validation, but it could be easily extended for OAuth, or some other form of authentication.

Continue reading

Service Locator Pattern with WCF and Unity

The Service Locator Pattern is no stranger to enterprise design patterns. In fact, you will see it quite frequently when working in corporate infrastructures. Some developers love it, others despise it. This post isn’t to debate the case for or against the Service Locator. It is, however, a practical example on how to leverage the pattern utilizing WCF & Unity.

Continue reading

WCF Bindings with Kerberos Message Security

Message security and Kerberos seem to go hand in hand these days in the world of WCF. While Microsoft makes it particularly easy for you to secure a respective service under wsHttpBinding with Kerberos, I was unsure how do to this while running under SOAP 1.1. Thankfully, Microsoft gives us a very robust customBinding configuration solution for these cases when wsHttpBinding or basicHttpBinding just won’t do.

Continue reading

Create WCF Service Client with Kerberos Impersonation

Let’s face it, we as developers would love nothing more than to work with the latest and greatest in terms of technology, languages, and frameworks. But, more often then naught, we are called upon to interface with, extend, or gasp rewrite existing applications written in god knows what language. Projects like these are always a sticky situation with developers, and most of the time, end up being a hacked together unmaintainable mess.

Continue reading

Use a .NET configuration file with a class library DLL

Configuration files are a lifeblood for just about every .NET developer. You don’t realize how much you rely on the configuration file until it’s not readily available to you. I recently had to travel down the path of either rolling my own configuration file solution, or figuring out how to leverage the .NET configuration solution from a stand alone class library.

Continue reading