How we did this, and I believe the general approach is to create an HTTP module. Modules are called with every request that is attached to your application, as part of the request pipeline, and have access to resources throughout the request. You can check each request and take actions, such as performing authentication and changing headers based on the request. They also allow you to examine the outgoing response and modify it.
Notes http://msdn.microsoft.com/en-us/library/bb398986.aspx is an excellent resource if you are new to modules.
Hope this helps!
source
share