<p>How can I specify the filename when dumping data into the response stream?</p>

<p>Right now I'm doing the following:</p>

<pre><code>byte[] data= GetFoo();
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/pdf";            
Response.BinaryWrite(data);
Response.End();
</code></pre>

<p>With the code above, I get "foo.aspx.pdf" as the filename to save.  I seem to remember being able to add a header to the response to specify the filename to save.</p>

```
```
Response.AppendHeader("Content-Disposition", "attachment; filename=foo.pdf");
```
```