ASP.NET 4.5 provides us with the full C# language features described previously in Chapter 2, Exploring the Top New Features of the CLR. Also, the additional methods and features make it easier for us to work with asynchronous language features.
This helps enormously in writing asynchronous HTTP modules and handlers.
Performance is also improved, as the model is asynchronous; it doesn't keep the thread blocked until the request is completed.
We are going to create an asynchronous HTTP module. An HTTP module allows us to intercept HTTP requests for modifying those requests so we can generate a response in a customized way.
Create a new class library project and name it
AsyncHTTPModule
.Add a reference to the
System.Web
assembly.Add a class and name it
CustomModule
. Note that we could as well add an item of typeASP.NET
, which would do most of the following for us:Add...