views:

55

answers:

1

i want to add some httphandlers for aspx pages by code via a http module.

is that possible? if it is, how?

thanks your advance..

+1  A: 

Inherit IHttpModule, override Application_BeginRequest perform your rewrite logic and rewrite the URL with:

private void Application_BeginRequest(Object source, EventArgs e) {
((HttpApplication)source).Context.RewritePath(...);
}

Then register it in web.config with:

<httpModules>
  <add name="UrlRewriteHandler" type="namespace.UrlRewriteHandler,project"/>
</httpModules>

Hope that helps.

Matt W