title: Prevent ASP.Net AppDomain Unload
body: <p>As described <a href="https://stackoverflow.com/questions/1661584/compiling-an-aspx-page-into-a-standalone-program/1687809#1687809">here</a>, I'm writing a WinForms GUI that is run in an ASP.Net AppDomain.</p>
  
  <p>However, whenever Web.config or the bin folder is modified, ASP.Net unloads the AppDomain, and the entire program dies.</p>
  
  <p>Is there any way to prevent this?</p>
  
  <p><strong>2<sup>nd</sup> EDIT</strong>: In my EXE, I create the AppDomain by calling <a href="http://msdn.microsoft.com/en-us/library/system.web.hosting.applicationhost.createapplicationhost.aspx" rel="nofollow noreferrer"><code>ApplicationHost.CreateApplicationHost</code></a> and pass it a type in my EXE that launches the GUI.</p>
  
  <p><strong>EDIT</strong>: I'm already aware that this is a <strong><em>horrible</em></strong> design.<br>
  Does anyone have a sane alternatives?</p>
  
  <p>The program tracks accounts for a non-profit organization in a typed dataset.<br>
  It needs to send bills by email, and I'm using ASPX files to generate the emails.  (I'd rather not change that, unless there's a very nice alternative; the templates have already been written)</p>
  
  <p>The email templates are ASPX files that are deployed in a subfolder; that subfolder becomes the ASP.Net application and has the executable in its <code>bin</code> directory for ASP.Net to load all of my code into its AppDomain.</p>
  
  <p>The typed dataset must be accessed by both the UI and the ASPX files, and I don't want to download the data from SQL server twice</p>