Is there a way to complete the post back after writing out a file to the Response?
问题 I have a button that when clicked, will generate a PDF and write it out to the response. This is the basic structure of the code: try { using(Stream stream = generatePdf()) { var file = createFile(stream); file.Transmit(HttpContext.Current.Response); } } catch (Exception ex) { // Handle exception // Display Error Message } The transmit method contains the following code: response.AddHeader("Content-Disposition", String.Format("attachment; filename={0}", filename)); response.AddHeader("Content