Sign In  Sign Up Live-Chat

Use ForceDownload to send an attachment to a browser after headers have been sent?

Last post 01-30-2008, 3:04 AM by saqib.razzaq. 2 replies.
Sort Posts: Previous Next
  •  01-25-2008, 2:00 PM 110521

    Use ForceDownload to send an attachment to a browser after headers have been sent?

    Hello,

    I'm taking a look at the ForceDownload method and I'm trying to figure out a way to use it in my scenario, but I'm stuck and wondering if you have any suggestion that might help.

    I have a web application that uses Aspose.Words to generate documents. The main page of the application has a button from which I generate the Word document and send it immediately to the browser (using the doc.Save method in Words).

    The problem is that the process can be quite lengthy and I'd like to show a progress bar in the browser, which I can do, but after sending progress bar information to the browser I can no longer save the Word document directly to the browser because of "Server cannot clear headers after HTTP headers have been sent."

    I realize I can't send a new response to the browser, but I'm hoping you all might have come up with a way (perhaps by redirecting to another page?) of how I might be able to show the progress bar AND deliver the file (without using window.open() or other pop-up techniques).  ForceDownload looks like it would be really helpful here.

    Anyway, I'd be grateful if you have any ideas.
    Mike

    PS -- I did try

    Response.Flush();
    Response.ClearHeaders();
    DataUtil.ForceDownload(this.Page, fileURL, "output.doc", "application/msword", true);

    but to no avail.
     
  •  01-29-2008, 1:14 PM 110976 in reply to 110521

    Re: Use ForceDownload to send an attachment to a browser after headers have been sent?

    Hi,

    I am looking into this and get back to you shortly.


    Best Regards,

    Saqib Razzaq
    Support Developer
    Aspose Guangzhou Team

     
  •  01-30-2008, 3:04 AM 111046 in reply to 110976

    Re: Use ForceDownload to send an attachment to a browser after headers have been sent?

    Hi Denver,

    May be you can try using a frame and use that frame for downloading the document. Can you post the code here or email at saqib.razzaq@aspose.com. I will be able to analyze it better then.


    Best Regards,

    Saqib Razzaq
    Support Developer
    Aspose Guangzhou Team

     
View as RSS news feed in XML