ASP.net text file download generation
<p>I tried to look this up all over the place, but none of the examples given online helps me.</p>

<p>I basically want a button on an ASP.net page to generate some text in memory, and when the user clicks on it, display a download dialog for a user to download a text file with the generated text.</p>

<p>The code I have currently is: </p>

<pre><code>Response.Clear();
Response.ClearHeaders();

Response.ContentType = "text/csv";
Response.AppendHeader("Content-Disposition", "attachment;filename=cartune.csv");

string text = "hello";

Response.Write(text);
Response.End();
</code></pre>

<p>But it doesn't work in Firefox 3.5 nor IE 8.0, I get no download response from the browsers at all... Many examples given online are similar to the code I have, so can any experts please point out to me what I am doing wrong?</p>

<p>I am running debugging mode in the Visual Studio 2008 deubugger, not IIS.</p>

<p>Thanks!</p>
