protected virtual void Application_BeginRequest(object sender, EventArgs e)
{
if (Thread.CurrentThread.Name == null)
{
Thread.CurrentThread.Name = Project.GenerateThreadId();
log.InfoFormat("Thread name set to {0}", Thread.CurrentThread.Name);
}
if (initializationError != null)
{
StringBuilder html = new StringBuilder();
using (TextWriter writer = new StringWriter(html))
{
SageHelpException helpException = new SageHelpException(initializationProblemInfo, initializationError);
helpException.Render(writer, new SageContext(this.Context));
}
this.Response.Write(html.ToString());
this.Response.Cache.SetCacheability(HttpCacheability.NoCache);
this.Response.Cache.SetNoStore();
this.Response.End();
}
var context = new SageContext(this.Context);
if (context.LmCache.Get(ConfigWatchName) == null)
Project.InitializeConfiguration(context);
if (!Project.IsStarted)
{
lock (lck)
{
if (!Project.IsStarted)
{
Project.Start(context);
}
}
}
if (this.Context != null)
log.InfoFormat("Request {0} started.", HttpContext.Current.Request.Url);
else
log.InfoFormat("Request started (no context)");
}