I am trying to implement a session-per-request pattern in an ASP.NET MVC 2 Preview 1 application, and I've implemented an IHttpModule to help me do this:
public class SessionModule : IHttpModule
{
public void Init(HttpApplication context)
{
context.Response.Write("Init!");
context.EndRequest += context_EndRequest;
}
// ... etc...
}
And I've put this into the web.config:
<system.web>
<httpModules>
<add name="SessionModule" type="MyNamespace.SessionModule" />
</httpModules>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<remove name="SessionModule" />
<add name="SessionModule" type="MyNamespace.SessionModule" />
</modules>
However, "Init!" never gets written to the page (I'm using the built-in VS web server, Cassini). Additionally, I've tried putting breakpoints in the SessionModule but they never break. What am I missing?