ASP.NET - How to postback a page after a file download?
<p>Here my situation :</p>

<p>The user click on a LinkButton, and the page does a PostBack. But I also need to prompt a file download to the user at the same time.</p>

<p>In order to do that, I did this on the LinkButton</p>

<pre>
lnkPrint.Attributes.Add("onclick", "window.open('Download.ashx?type=x')");
</pre>

<p>The <strong>Download.ashx</strong> Http Handler generates the file (Content-Type : <strong>application/pdf</strong>), and if I click on my LinkButton, it does PostBack and download the file after showing a popup... But I can't manage to close this popup automatically.</p>

<p>I tried some methods </p>

<ul>
<li>settimeout('self.close()',1000) after the download</li>
<li>Setting a RegisterStartupScript on the LinkButton.Command, to trigger the download after the postback, but IE6 prompts a warning that disturbs my users </li>
</ul>

<p>So, none of these methods seems to work fine.</p>

<p>So, my question is : Is there a way to make the popup instantly disappear, or is there a means to make the page download the file <strong>AND</strong> postback at the same time ?</p>

<p>PS : I thought of the <strong>Your download will begin shortly</strong> method, but I'm afraid I'll have the same issues as before with the RegisterStartupScript...</p>
