ASP.NET: Writing web-accessible temp files without application restart
<p>My ASP.Net application used to restart unpredictably during requests, ruining my state, session data etc. I determined that the problem was caused by a control that writes and deletes some files in <code>Temp</code> folder that it creates near <code>bin</code> folder, so the web directory looks like this:</p>

<pre><code>bin
Temp
....
Default.aspx    
web.config
</code></pre>

<p>ASP.Net apparently reacts to changes inside <code>Temp</code> folder the same way it reacts to changes inside <code>bin</code> or in web.config - it restarts the application.</p>

<p>I could partially solve the problem by moving the <code>Temp</code> outside the site directory. That way the application doesn't get restarted every time something temporary is written\deleted, so this part works well. The problem is that some of the files inside <code>Temp</code> directory should be web-accessible - like images generated on the fly and such.</p>

<hr>

<p>So my question is actually threefold:</p>

<ol>
<li>Should ASP.Net application get restarted even if the changes are made not in the <code>bin</code> directory, but in another directory at the same level? Or is there something wrong with my configuration?</li>
<li>Where and how do I create a temporary folder so it's web-accessible but it doesn't cause application restart?</li>
<li>How do I turn off restart on directory change from code or web.config (both in IIS and ASP.Net development server)?</li>
</ol>
