We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Page not closing in ie 6 sp 3 after Export (Document.Save)

Hi all,
First of all i want to thank you for your great software. Keep up the good work guys.
I have a question, hope you may be able to help me out.
I implemented the exporting of Aspose.Words in a pop-up page, the then page closes after the export. It works great on ie 6 sp 2, ie 7 and ie 8. Unfortunately, for some reason the pop-up doesn’t close in ie 6 sp3. Below is the code snippet in question:

doc.Save(sFileName, Aspose.Words.SaveFormat.Doc, Aspose.Words.SaveType.OpenInApplication, Page.Response);
Page.ClientScript.RegisterStartupScript(this.GetType(), "CloseMe", "window.close();", true);

I have even tried Response.Write to close the page, it still doesn’t work.
Do you have any ideas?
Thank you.

Hi

Thanks for your inquiry. I do not this the problem is related to Aspsoe.Words. Have you tried using the same code to close popup but without saving the document. For example, create a page like the following and check whether it will be closed as expected.
using System;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Page.ClientScript.RegisterStartupScript(this.GetType(), "CloseMe", "window.close();", true);
    }
}

Also, maybe in your case you can try using the approach suggested in our ajax demos. Please follow the link for more information:
https://demos.aspose.com/
Best regards,

Hello,
Thanks very much for the prompt reply and for being helpful.
I have tried closing the popup without saving the document, and it closes properly.
Unfortunately, our we are not allowed to use ajax so i am not able to use your given link.
I have attached a simple program to demonstrate the bug. I must stress that the bug only happens in ie 6 sp 3, all other versions of ie that i have tried it works properly. I have also attached a screenshot of the exact version of the ie in question.
Again thank you.
Toff

Hi

Thank you for additional information. Please try also using the following code:

using System;
using Aspose.Words;
using System.Web.UI;
using Aspose.Words.Saving;
namespace AsposeTest
{
    public partial class Download : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Document doc = new Document();
            doc.Save(Response, "a.doc", ContentDisposition.Attachment, new DocSaveOptions(SaveFormat.Doc));
            Response.End();
            Page.ClientScript.RegisterStartupScript(this.GetType(), "CloseMe", "window.close();", true);
        }
    }
}

Also, you can try using code like the following for testing:

using System;
using System.IO;
using System.Web.UI;
namespace AsposeTest
{
    public partial class Download : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Clear();
            // Specify the document type.
            Response.ContentType = "application/word";
            // Specify how the document is sent to the browser.
            Response.AddHeader("content-disposition", "attachment; filename=MyDocument.doc");
            // Get data bytes from the file and send it to the response.
            byte[] bytes = File.ReadAllBytes(@"C:\\Temp\\in.doc");
            Response.BinaryWrite(bytes);
            Response.End();
            Page.ClientScript.RegisterStartupScript(this.GetType(), "CloseMe", "window.close();", true);
        }
    }
}

As you can see this code does not use Apsose.Words, but just sends a file to client browser.
Best regards,