title: How to set an application variable on application startup
body: <p>I try to set an Application object in a class of type IProcessHostPreloadClient (code is running on application initialization, explained here: <a href="http://www.codeproject.com/Articles/795265/IIS-Asp-net-warm-up-Auto-Start-Application" rel="nofollow">http://www.codeproject.com/Articles/795265/IIS-Asp-net-warm-up-Auto-Start-Application</a>):</p>
  
  <pre><code>public class DeserializeEdocsProvider : System.Web.Hosting.IProcessHostPreloadClient 
  {
      public void Preload(string[] parameters)
      {
          ... 
              //the following fails with message:
              //"Object reference not set to an instance of an object."
              HttpContext.Current.Application["testtest"] = "test";
          ...
      }
  }
  </code></pre>
  
  <p>All I want is to create an object when the application starts (after recycle of application pool), and access the object later, in other requests to the web application. Any solution is appreciated.</p>