Hi,
As far as I know, you should implement the event-handler in a IHttpModule's init method this way:
public void Init(HttpApplication context)
{
context.BeginRequest += context_BeginRequest;
}
and add the HttpModule class you created in the web.config httpModule- / modules-Section:
<configuration>
<system.web>
<httpmodules>
<clear />
<add name="RedirectHandler" type="RedirectorModule.RedirectHandler" />
<add name="RewriteHandler" type="RedirectorModule.RewriteHandler" />
</httpmodules>
</system.web>
<system.webserver>
<modules runallmanagedmodulesforallrequests="true">
<remove name="RedirectHandler" />
<add name="RedirectHandler" type="RedirectorModule.RedirectHandler" />
<remove name="RewriteHandler" />
<add name="RewriteHandler" type="RedirectorModule.RewriteHandler" />
</modules>
</system.webserver>
</configuration>
For more informations, I made a blog entry about a basic URL Rewriter:
http://blog.dotnetcorner.ch/post/2011/03/30/How-to-Create-an-easy-and-flexible-URL-Rewriter.aspx[
^]
Hope this helps.
Best regards and happy coding,
Stops
-- UPDATE: added Web.config modifications.