Overriding or injecting code in the Application_Start event in Umbraco can be a little tricky. You have to inherit the Umbraco Application class and override the methods you need. Unless you need to override something specific in the Umbraco pipeline it should be sufficient just to let your startup code run immediately AFTER the Application_Start event.
The WebActivator NuGet package allows us to execute some startup code early in the ASP.NET pipeline. WebActivator was introduced with NuGet to solve the problem of running code without having to add it in the global.asax
Install the WebActivator package from NuGet
Add a static class to your Visual Studio project. This class will contain your startup code
public static class Init
public static void Run()
//Your start up code here
Next wire up your startup code in the AssemblyInfo.cs
[assembly: PostApplicationStartMethod(typeof(Init), "Run")]
Here's a full screenshot of AssemblyInfo.cs
The PostApplicationStartMethod attribute as the name suggests will run your custom startup code After the Application Start event.
Wednesday June 26, 2013, By Anton Pham