Application start? Begin request? What are the Orchard mechanisms?

Topics: Core, General
Jun 13, 2014 at 2:06 PM
Edited Jun 13, 2014 at 3:14 PM
I think the title is pretty clear already. I've found a page describing how the ASP.NET lifecycle is viewed from an Orchard perspective (ref: and But I still can't figure out how I should hook events to the Begin request step of the application or even more preferrably the Application start step (in which I can hook up other events maybe?)

I already tried creating a IOrchardShellEvents implementation in which i execute code in the Actived() method. However this seems to run at every site request and needs additional statements. Also I don't want to be changing any global.asax files.

What are the preferred mechanisms in Orchard to execute code for Application start and/or Begin request events in the ASP.NET equivalent?
Jun 17, 2014 at 11:23 AM
I don't think you can hook into the App_Start from a module without modding because that's just too early, but IOrchardShellEvents.Activated() is your best bet. That should only be called on the start of each shell (tenant), not on every request.

The same for request events, the closest you can get are MVC request filters.