title: Correct way of using variables from global.asax
body: <p>I have a simple global.asax file that runs some code at startup and stores a handle in a variable. I want to access that variable from my other files in the project. Here is my global.asax:</p>
  
  <pre><code>&lt;%@ Application Language="C#" %&gt;
  &lt;script runat="server"&gt;
  
      static JustTesting justTesting;
      static public JustTesting JustTesting { get { return justTesting ; } }
  
      void Application_Start(object sender, EventArgs e) 
      {
          //my code here
      }
  
      void Application_End(object sender, EventArgs e) 
      {
          //  Code that runs on application shutdown
  
      }
  
      void Application_Error(object sender, EventArgs e) 
      { 
          // Code that runs when an unhandled error occurs
  
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>And when I want to use that variable...</p>
  
  <pre><code>ASP.global_asax.JustTesting
  </code></pre>
  
  <p>...which works, but I'm sure there must be a more elegant way of calling it instead of having to add <code>ASP.global_asax.</code> all the time.</p>