Forces to prompt download box IE
- by Bruno Costa
Hello,
I'm having a problem with some reports in the application I'm doing manutention
I've a button that does a postback to the server and do some information and then get back to the cliente and open a popup to download the report.
private void grid_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
...
ClientScript.RegisterClientScriptBlock(this.GetType(), "xxx", "<script>javascript:window.location('xx.aspx?m=x','xxx','width=750,height=350,directories=no,location=no,menubar=no,scrollbars,status=no,toolbar=no,resizable=yes,left=50,top=50');</script>");
}
Then in xxx.aspx I've the code:
Response.ClearContent();
Response.ClearHeaders();
Response.TransmitFile(tempFileName);
Response.Flush();
Response.Close();
File.Delete(tempFileName);
Response.End();
This works fine if IE option Automatic prompting for file downloads is enabled. But by default this is disabled and I need to force the download box to be prompting.
Can I do anything without change a lot of code?
Thanks.