In Asp.net, on button click, how to open a download dialog, and then redirect the user to another page?
<p>I have a button. When the user clicks it, I want to trigger a download dialog box, and then redirect the user to another page.</p>

<p>However, I'm having problems getting the download and redirect to run together. Once the download dialog box is shown, execution on the rest of the code seems to end:</p>

<pre><code>Sub DisplayDownloadDialog(ByVal filepath As String)
    Dim filename As String = Path.GetFileName(filepath)
    Response.ContentType = "application/octet-stream"
    Response.AddHeader("Content-Disposition", "attachment; filename=""" &amp; filename &amp; """")
    Response.WriteFile(filepath)
End Sub
</code></pre>

<p>I tried to add a refresh to the header, but it still doesn't work. I also tried javascript (but not using window.open...since some browsers block that), but I can't get a redirect to work.</p>

<p>Any ideas? I really appreciate the help.</p>
