title: How can I get the web application assembly in ASP.NET without Global.asax?
body: <p>I want to dynamically get the assembly for the currently executing web application from any code referenced by that application and executed in the same AppDomain.</p>
  
  <p>I want exactly what this question asks: <a href="https://stackoverflow.com/questions/7463284/get-web-application-assembly-name-regardless-of-current-executing-assembly">Get web application assembly name, regardless of current executing assembly</a></p>
  
  <p>However, all replies in that question use the <code>Global.asax</code> file to get the web app assembly. That doesn't work if the application doesn't have a global.asax file, since in this case the type returned is <code>HttpApplication</code>, which is in the <code>System.Web</code> assembly.</p>
  
  <p>One way I thought about going is to filter the assemblies in the current AppDomain by something, but I don't know what this something could be. Is there any difference between the assembly of the web app and another normal DLL? I know that the projects in Visual Studio have a GUID to signify the type of project (ASP.NET Web App, class library, MVC app, etc.) Is this info somehow present in the compiled assembly?</p>
  
  <p>Another approach could be to use the <code>ApplicationHost</code> from the <code>System.Web.Hosting</code> namespace, but that only has static data and nothing about assemblies.</p>
  
  <p>A third approach would be to include a type in the web app project and use that type, but for that my code which needs to get the web assembly name needs a reference to that type (and that would be a circular reference).</p>
  
  <p>Any ideas?</p>