When the web application starts, the HTTP request is not processed.
You may need to process the Application_BeginRequest (Object Sender, EventArgs e) method in which the request context is available.
Edit: Here is a sample code inspired by the Mike Volodarsky block that Michael Shimmins linked to:
void Application_BeginRequest(Object source, EventArgs e) { HttpApplication app = (HttpApplication)source; var host = FirstRequestInitialisation.Initialise(app.Context); } static class FirstRequestInitialisation { private static string host = null; private static Object s_lock = new Object();
cspolton Nov 22 2018-10-22T00: 00Z
source share