Boilerplate to serve up a generated file from ASP.NET
<p>Does anyone know of a base class that can be used to serve up an arbitrary file (potentially dynamically generated and temporary) from ASP.NET?</p>

<p>The kind of interface I'm thinking of would very simple and look something like this:</p>

<pre><code>class FilePage : Control // I think... 
{
    protected Filename { get; set; } // the filename to dump out
    protected bool Delete { get; set; } // Delete the (temporary) file when done?
    protected string ContentType { get; Set; } // MIME type of the file

    abstract protected void BindData();        
}
</code></pre>

<p>you would derive from it and, in the abstract method, create whatever file you need to, set the properties and let the base class handle the rest.</p>

<p>My current use case is that I want to export data as an SQLite database.</p>

<p><hr /></p>

<p><em>edit:</em></p>

<ul>
<li>Superfiualy related to <a href="http://stackoverflow.com/questions/952667/solved-how-to-output-a-simple-c-asp-net-generated-kml-file">this question</a> except that I <em>must</em> generate a temporary file.</li>
</ul>
