In my code, I am using javascript to fire off a window.open on an ASPX page. In the page-load of that page, I'm outputting a file:
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.Charset = "";
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment;filename=\"" + filename + "\";");
outputStream.WriteTo(Response.OutputStream);
outputStream.Flush();
outputStream.Close();
Response.Flush();
Response.Close();
After this, I would ideally like to close the popup window. However, because I have changed my response type, I cannot output the normal window.close javascript. It will merely get appended to the file being given to the users. The closest I have come to a solution is this thread:
http://forums.asp.net/t/1186371.aspx?PageIndex=1
But even there in the end the guy didn't get any answers. As far as I can see, there is no way to do this. However, I'd like to ask you for your help before I give it up entirely and just have something telling the users to close the window manually. Any suggestions?