G
Guest
I'm trying to download a file that is created on the fly from a string, and am using the following code in a new page
_PrintJobData = // a string returned from a metho
_FileName = "PrintJobs_" + System.DateTime.Now.ToString() + ".txt"
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", "attachment; filename=" + _FileName)
Response.Flush()
Response.Write(_PrintJobData)
Response.End()
I know that this is a bit of an old chestnut, but I need to close the browser window after the file download dialog appears, and of couse cannot do something like:
Response.Write("<script language=\"javascript\">window.close()</script>")
because Response.End() has been called. Does anybody know of an alternative way of doing this
Thanks
_PrintJobData = // a string returned from a metho
_FileName = "PrintJobs_" + System.DateTime.Now.ToString() + ".txt"
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", "attachment; filename=" + _FileName)
Response.Flush()
Response.Write(_PrintJobData)
Response.End()
I know that this is a bit of an old chestnut, but I need to close the browser window after the file download dialog appears, and of couse cannot do something like:
Response.Write("<script language=\"javascript\">window.close()</script>")
because Response.End() has been called. Does anybody know of an alternative way of doing this
Thanks