title: Order of execution of the absolute earliest places to run code in ASP.NET
body: <p>There are numerous places you can have initialization code be executed in ASP.NET:</p>
  
  <ul>
  <li>web.config is processed </li>
  <li>WebActivator <code>PreApplicationStartMethod</code></li>
  <li>WebActivator <code>PostApplicationStartMethod</code></li>
  <li>Global.asax  <code>Application_Start</code></li>
  </ul>
  
  <p>What is the ordering of these occurences? Are there any other additional items that should be to this list?</p>
  
  <p><strong>Edit:</strong> Since it was mentioned that statics are relevant to first invocation location, I'm going to break this up for them</p>
  
  <p>Foo class that is used in a WebActivator <code>PreApplicationStartMethod</code></p>
  
  <ul>
  <li>static constructor</li>
  <li>static readonly field</li>
  </ul>
  
  <p>Bar class that is used in a WebActivator <code>PostApplicationStartMethod</code></p>
  
  <ul>
  <li>static constructor</li>
  <li>static readonly field</li>
  </ul>
  
  <p>Baz class that is used in a Global.asax  <code>Application_Start</code></p>
  
  <ul>
  <li>static constructor</li>
  <li>static readonly field</li>
  </ul>
  
  <p>For clarity purposes, suppose that in the above examples each of those depends on the Foo/Bar/Baz class being used in the location and that the class contains  a static constructor and static readonly field. </p>