ASP.Net form submission that returns CSV
<p>I'm having trouble getting my ASP.Net page to return CSV on submit being clicked. Here's the asp button definition I have for the submit button in Form.aspx:</p>

<pre><code>&lt;asp:Button id="submitreport" name="submitbutton" text="submit" OnClick="Report_Submit" runat="server" /&gt;
</code></pre>

<p>And this is the corresponding function in Form.aspx.cs:</p>

<pre><code>public void Report_Submit(object sender, EventArgs e) {
    Debug.WriteLine("GETS HERE?");
    Response.Charset = "UTF-8";
    Response.Cache.SetCacheability(HttpCacheability.NoCache);
    Response.Cache.SetAllowResponseInBrowserHistory(true);
    Response.ContentType = "text/csv";
    Response.AddHeader("Content-Disposition", "attachment; filename='" + DateTime.Today.ToString() + ".csv'");
    Response.Write("test,output");
    Response.End();
}
</code></pre>

<p>When this is ran in Visual Studio I don't even see the debug print line. Does anybody know what's wrong with my setup?</p>

<p>Edit: I know for certain that the pages are set up right because if I put a breakpoint on my empty Page_Load function in Form.aspx.cs VS does break there. Besides that the breakpoint at the debug write line is skipped over on the form submit and the same page is returned again.</p>

<p><strong>Update</strong> By creating a new project with just the button and the handler the Report_Submit() function is called and the CSV file is correctly generated. Since that narrows it down a little bit, does anybody know what could be going on in my other VS 2008 project that's causing this not to work?</p>
