IHttpModule Things I have noticed

Paul Kinlan

Something I have learnt today whilst playing with is that when the Init method is called you shouldn’t access the Context method the HttpAplication exposes because it seems like it is not fully constructed (things like the HttpMethod, QueryString and Form properties are not created).

However, if you handle an event like such:

context.BeginRequest += new EventHandler(Context_BeginRequest);

then once you enter the EventHandler, the Context Object (attached to the source parameter) seems to be fully constructed.

private void Context_BeginRequest(object sender, EventArgs e)
{
_context = ((HttpApplication)sender).Context;


Paul Kinlan

Trying to make the web and developers better.

RSS Github Medium