I'm developing an IIS module that is supposed to be triggered when a request is made to all kind of pages on my webserver (managed and unmanaged). To accomplish that I implemented the IHttpModule
interface that has a method called HandleRequest
which have to be implemented. In the method context I have access to an HttpApplication
object and HttpContext
object.
Is there any indication in these objects or any other place to tell if the request that is now being handled by the module was issued to a managed page (e.g aspx,asmx,web-api,mvc,wcf) or to an unmanaged page (e.g jpg,css,htm..).
Here is the code:
public class MyPreIISReqeustModule : System.Web.IHttpModule
{
public void Dispose()
{
}
public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(HandleRequest);
}
protected void HandleRequest(Object sender, EventArgs e)
{
if (managed_page_request)
{......}
else
{......}
}
}