(Practical article)
[Date: 2004-10-27] Source: http: //www.cnblogs.com/rrooyy/ Author: Simple Life [font: medium and small]
First write a class that handles URLS rewriting, and this class must inherit the IHTTPHANDLER interface. Take the Board's program: public class urlrewritemodule: system.web.ihttpmodule {public void init (httpApplication context) {Context.BeginRequest = New EventHandler (CONTEXT_BEGINREQUEST); PUBLIC VOID DISPOSE ()}} URLREWRITEMODULE class is a class that handles URLS rewriting, inheriting the IHTTPHANDLER interface, implementing two methods, init, and dispose of the interface. Register your own defined method in the init method, as shown in the above example: Content.BeginRequest = New EventHandler (content_beginRequest); beginRequest is an event, triggering when receiving a new HTTP request, Content_BeginRequest is a method of triggering. Also explained, HTTPModules can register there are many ways, such as endRequest, Error, Disposed, PresendRequestContent, and more. Details of the URLS rewriting in the Content_BeginRequest method, such as