[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

HTTPResponse output stream write file to Word failed to download in IE 9....

Posted on 2011-10-26
3
Medium Priority
?
1,518 Views
Last Modified: 2012-06-27
Hi

When i try to write a byte array to a .docx file in IE 9 , it failes to download, and when i retry it opens up a word document with error message saying that the file is broken or corrupt..... And if i try to open it in FireFox every thing workes fine, so whats the problom with IE 9? This message box is saying that: Found unreadable content in file "Saksliste". Do you want to reproduce the document...bla bla...
private void ReturnDoc(byte[] doc, string filename)
        {
            HttpResponse resp = HttpContext.Current.Response;

            resp.Clear();
            resp.ClearContent();
            resp.ClearHeaders();
            resp.Buffer = true;

            resp.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
            resp.AddHeader("content-disposition", "attachment;filename=" + filename);
            resp.AddHeader("Content-Length", doc.Length.ToString());

            resp.OutputStream.Write(doc, 0, (int)doc.Length);
            resp.Flush();
           
            // resp.BinaryWrite(doc);
            resp.Close();

            HttpContext.Current.ApplicationInstance.CompleteRequest();

        }

Open in new window

970214cbbe.jpg
0
Comment
Question by:Adnan
  • 3
3 Comments
 

Accepted Solution

by:
Adnan earned 0 total points
ID: 37030981
What iam trying to do is  I am streaming a Word document to the browser, This works in all browsers over HTTP and all browsers except IE over HTTPS.....!!

I found this articale when i google: http://stackoverflow.com/questions/1202285/generating-pdf-error-with-ie-and-https
And here they are saying that the problom is around allowing  method of streaming PDF, Excel or Word documents when the 'Do not save encrypted pages to disk' option is turned on in the IE/browser...?!
0
 

Author Comment

by:Adnan
ID: 37031065
I turned 'Do not save encrypted pages to disk' option is turned off and every thing is working now....STUPID IE
0
 

Author Closing Comment

by:Adnan
ID: 37031129
Probom fixed after tairing my hair of in 2 days
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question