ASP.NET MVC PostAuthorizeRequest (and other events) does not fire

I am working on a mvcForum project (on codeplex) and want to remove as much code as possible from the global.asax file - mainly to simplify the integration of mvcForum into an existing ASP.NET MVC application without changing too much code.

I need to connect to application events in order to be able to set the correct CultureInfo (depending on user choice, etc.), etc.

This is not a problem with this in the global.asax file:

protected void Application_PostAuthorizeRequest() {
       // Some code here!
}

But when I try to move the code somewhere else, the event will never happen. What I am doing is:

public MVCForumBootstrapper(HttpApplication app) {
    app.PostAuthorizeRequest += new EventHandler(app_PostAuthorizeRequest);
}

And this is in global.asax

    protected void Application_Start() {
      var strapper = new MVCForumBootstrapper(this);
    }

Did I seem to expect this to work exactly the same?

What am I doing wrong / missed?

Thanks, Steen

+5
1

Init Global.asax. Application_Start :

public override void Init()
{
    base.Init();
    var strapper = new MVCForumBootstrapper(this);
}
+6

All Articles