internal static HttpApplication GetApplication (HttpContext context)
{
HttpApplicationFactory factory = theFactory;
HttpApplication app = null;
if (factory.app_start_needed){
if (context == null)
return null;
factory.InitType (context);
lock (factory) {
if (factory.app_start_needed) {
foreach (string dir in HttpApplication.BinDirs)
WatchLocationForRestart (dir, "*.dll");
// Restart if the App_* directories are created...
WatchLocationForRestart (".", "App_Code");
WatchLocationForRestart (".", "App_Browsers");
WatchLocationForRestart (".", "App_GlobalResources");
// ...or their contents is changed.
WatchLocationForRestart ("App_Code", "*", true);
WatchLocationForRestart ("App_Browsers", "*");
WatchLocationForRestart ("App_GlobalResources", "*");
app = factory.FireOnAppStart (context);
factory.app_start_needed = false;
return app;
}
}
}
app = (HttpApplication) Interlocked.Exchange (ref factory.next_free, null);
if (app != null) {
app.RequestCompleted = false;
return app;
}
lock (factory.available) {
if (factory.available.Count > 0) {
app = (HttpApplication) factory.available.Pop ();
app.RequestCompleted = false;
return app;
}
}
return (HttpApplication) Activator.CreateInstance (factory.app_type, true);
}