Skip to content

Tag: .NET

Branching Pipelines with OWIN

Branching pipelines with OWIN allow for several different request pipelines to be used as needed depending on a determining factor. This factor is most often a Hostname but it could be any sort of toggle. An example might be authentication. Your system might need to allow for different authentication mechanisms for different users. The set up for authentication happens once when the app is built-in IIS for the first time and can be found in Startup.Auth. At this point the application hasn’t even received any requests so how is it supposed to know what authentication system to use? This is…

Exception handling in Web API 2

REST Web APIs are becoming more and more popular and have seen a large uptake recently. One of the nicer features that is available in the .NET web API 2 toolkit is it’s inbuilt exception handling. This allows you to maintain separation on concerns and stops controllers becoming bloated beasts of burden, or logging. A common scenario for people who have just started to build Web APIs is to blindly implement try-catch exception handling. This might look something like this As you can see, the actual code that performs the action that we want for this controller method is only…