Skip to main content

Leveraging httpModules for Better ASP.NET Applications

Leveraging httpModules for Better ASP.NET Applications

Chris Love

ISBN: 978-0-470-37939-4

Apr 2008

40 pages

Select type: E-Book

Product not available for purchase


This Wrox Blox explains how to create different types of custom modules for ASP.NET web sites. Custom ASP.NET Modules are a great way to program advanced features to your web site. This Wrox blox discusses the difference between a custom httpModule and the Global.asax file. It also covers the steps in the ASP.NET pipeline. The examples include using a custom module to configure a site's initial settings, a background worker thread, and an IP blocker. Other examples show how to add content to the content being sent to the client, URL Rewriting, and a custom error handler.

Table of Contents

Introduction to httpModules 1

How httpModules Are Processed 2

Modules versus Global.asax 3

A Minimal Custom httpModule 3

ASP.NET Page Life Cycle 5

Registering a Custom httpModule 7

Default httpModules 7

Remove Registered Modules 8

Use a Custom Module to Configure the Site 9

Creating a Background Thread Process 11

Modify Rendered Content 13

Optimizing the Response Output 16

Create an IP Filter 22

Rewrite a Request 25

A Custom Error Handler 28

Custom Modules in IIS 7 32

Summary 35

About Chris Love 36

Download code for Wrox Blox VB
Download code for Wrox Blox C