ASP.NET Application Start without using Global.asax
asp.net, configuration, global-asax
Solution
You can use a HTTPModule:
public class MyModule : IHttpModule
{
#region IHttpModule Members
public void Dispose()
{
}
public void Init(HttpApplication context)
{
...
}
#endregion
}
web.config
<httpModules>
<add name="MyModule" type="MyNamespace.MyModule, MyAssembly" />
</httpModules>
Problem
I'm developing a plugin like application for a web site. Due to requirements it will live in the same physical path and the same application pool as the main web site which I do not have the source code for. So they both share the same Web.config and some other dependencies. I need to set a license for a third party dependency at application start, but I have no way of accessing the code behind for Global.asax as that code is owned by a different company. So, is there an alternate way of appending events to Application Start without involving Global.asax or is my only solution to inherit/extend the current Global.asax?