473,379 Members | 1,542 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Generated Word document does not download in IE 6

Hello,

I have an asp.net pop up that is generating a Word document real time
and sending it to the user by sending the appropriate response
headers. When it is run on our development environment it works fine
in both IE6 and IE7. We recently moved this to our UAT environment
and it works fine for IE7, but IE6 users are getting the option to
only download or save the .aspx page, not the generated .doc file.

Has anyone run into an issue like this before?

Thanks,
Allan
Jun 27 '08 #1
2 2709
Absolutely, this can be quite a common situation.

I imagine that if you were to save the .aspx page with a .doc file
extension, you will actually receive the correct file. This is the default
behaviour of IE6 when running in the Internet zone.

You can get more reliable results using headers such as the following:

HttpContext.Current.Response.ContentType = "application/ms-word";
HttpContext.Current.Response.AppendHeader("Content-Disposition",
"attachment; filename=myWordDoc.doc");

Good luck,
BWC

"al************@gmail.com" wrote:
Hello,

I have an asp.net pop up that is generating a Word document real time
and sending it to the user by sending the appropriate response
headers. When it is run on our development environment it works fine
in both IE6 and IE7. We recently moved this to our UAT environment
and it works fine for IE7, but IE6 users are getting the option to
only download or save the .aspx page, not the generated .doc file.

Has anyone run into an issue like this before?

Thanks,
Allan
Jun 27 '08 #2
Hi BCW,

Thanks for you tips.

This is how I am popping the document from a asp:Button in another
part of the application, but when the user submits some form values, I
am trying to pop the word document to them after the post. I was
doing this, initially, but then I realized that the page stopped
processing after this (shockingly enough, i know). So I opted for
having a pop up window run this code, so the parent page can
complete. Everything works great with the pop-up in dev on both IE6
and IE7, but in our UAT env. it only works for IE6.

Thanks,
Allan

string attachment = "attachment; filename=MyDoc.doc";
Response.ClearContent();
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
htw.Write(SOMEWORDTEXT);
HttpContext.Current.Response.ContentType = "application/ms-word";
HttpContext.Current.Response.ContentEncoding =
System.Text.UnicodeEncoding.UTF8;
HttpContext.Current.Response.Charset = "UTF-8";
Response.AddHeader("Content-Disposition", attachment);
Response.Write(@"<html xmlns:o=""urn:schemas-microsoft-
com:office:office"" xmlns:w=""urn:schemas-microsoft-com:office:word""
xmlns=""http://www.w3.org/TR/REC-html40"">");
Response.Write("<head>");
Response.Write(@"<meta http-equiv=Content-Type content=""text/html;
charset=windows-1252"">");
Response.Write("<meta name=ProgId content=Word.Document>");
Response.Write(@"<meta name=Generator content=""Microsoft Word
11"">");
Response.Write(@"<meta name=Originator content=""Microsoft Word
11"">");
Response.Write(@"<link rel=File-List href=""Doc1_files/
filelist.xml"">");
Response.Write("<!--[if gte mso 9]><xml<o:DocumentProperties>
<o:Author</o:Author <o:LastAuthor</o:LastAuthor <o:Revision>1</
o:Revision <o:TotalTime>1</o:TotalTime>
<o:Created>2008-05-13T17:47:00Z</o:Created>
<o:LastSaved>2008-05-13T17:59:00Z</o:LastSaved <o:Pages>1</o:Pages>
<o:Company></o:Company <o:Lines>1</o:Lines <o:Paragraphs>1</
o:Paragraphs <o:Version>11.9999</o:Version</o:DocumentProperties></
xml><![endif]-->");
Response.Write("<!--[if gte mso 9]><xml<w:WordDocument>
<w:View>Print</w:View <w:DisplayBackgroundShape/>
<w:SpellingState>Clean</w:SpellingState <w:GrammarState>Clean</
w:GrammarState <w:PunctuationKerning/ <w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:Compatibility <w:BreakWrappedTables/ <w:SnapToGridInCell/>
<w:WrapTextWithPunct/ <w:UseAsianBreakRules/ <w:DontGrowAutofit/
</w:Compatibility <w:BrowserLevel>MicrosoftInternetExplorer4</
w:BrowserLevel</w:WordDocument></xml><![endif]-->");
Response.Write(@"<!--[if gte mso 9]><xml<w:LatentStyles
DefLockedState=""false"" LatentStyleCount=""156""</w:LatentStyles></
xml><![endif]-->");
Response.Write(@"<style><!--@font-face {font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4; mso-font-charset:0; mso-generic-font-
family:swiss; mso-font-pitch:variable; mso-font-signature:536871559 0
0 0 415 0;}p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-
parent:""""; margin:0in; margin-bottom:.0001pt; mso-
pagination:widow-orphan; font-size:8.0pt; font-family:""Verdana"";
mso-fareast-font-family:""Verdana"";}@page Section1 {size:8.5in
11.0in; margin:.5in .5in .5in .5in; mso-header-margin:.5in; mso-
footer-margin:.5in; mso-paper-source:0;}div.Section1
{page:Section1;}--></style>");
Response.Write(@"<!--[if gte mso 10]><styletable.MsoNormalTable
{mso-style-name:""Table Normal""; mso-tstyle-rowband-size:0; mso-
tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:"""";
mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-
margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:
8.0pt; font-family:""Verdana""; mso-ansi-language:#0400; mso-
fareast-language:#0400; mso-bidi-language:#0400;}</style><![endif]--
>");
Response.Write("</head>");
Response.Write("<body lang=EN-US style='tab-interval:.5in'>");
Response.Write(" <div class=Section1>");
Response.Write(" <p class=MsoNormal><span style='font-size:
8.0pt;font-family:Verdana'><o:p>");
Response.Write(sw.ToString());
Response.Write("</o:p></span></p>");
Response.Write(" </div>");
Response.Write("</body>");
Response.Write("</html>");

On Jun 20, 6:58*am, BWC <B...@discussions.microsoft.comwrote:
Absolutely, this can be quite a common situation.

I imagine that if you were to save the .aspx page with a .doc file
extension, you will actually receive the correct file. This is the default
behaviour of IE6 when running in the Internet zone.

You can get more reliable results using headers such as the following:

HttpContext.Current.Response.ContentType = "application/ms-word";
HttpContext.Current.Response.AppendHeader("Content-Disposition",
"attachment; filename=myWordDoc.doc");

Good luck,
BWC

"allan.s.pal...@gmail.com" wrote:
Hello,
I have an asp.net pop up that is generating a Word document real time
and sending it to the user by sending the appropriate response
headers. When it is run on our development environment it works fine
in both IE6 and IE7. *We recently moved this to our UAT environment
and it works fine for IE7, but IE6 users are getting the option to
only download or save the .aspx page, not the generated .doc file.
Has anyone run into an issue like this before?
Thanks,
Allan- Hide quoted text -

- Show quoted text -
Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Mike | last post by:
I am trying to write a web page where a person can click on a word document and MS Word is launched instead of the document being displayed in the IE browser. I have been able to launch MS Word but...
0
by: Chris J | last post by:
Hi all, ] I'm having a problem with Word 2002 when downloading a Word document with IE6. This is in an intranet application, and the download occurs through an ASP that does security checks...
4
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone...
12
by: Rob Nicholson | last post by:
We've implemented functionality to allow a user to download a document (any document type) from the IIS server using the following code: Response.Clear() Response.ContentType =...
0
by: gerard.buskermolen | last post by:
Hello world, I have an ASP.NET application that returns HTML to the browser that should be read by MS Word. To do this I set Response.ContentType = ContentType.Word...
2
by: aychai | last post by:
Hi all, I have a scenario where users fills in textbox fields on ASP.NET page from the server and when he/she clicks on a download button, the data from fields will insert into an existing word...
2
by: jefftim | last post by:
Hi All I've saved a word document in sql server database.I'm able to retrieve it from the database and open it in a word application. My problem is I'm able to open it in server/client machines...
0
by: robwahl | last post by:
Hi, I have a members only area of a site (using ASP and MS Access) where I need users to be able to either view or download reports (PDF or MS Word doc - doesn't matter which). I want to store...
6
by: cyusman | last post by:
Hi, We have just moved our application to a new webfarm server environment which utilizing hardware load balancing, SSL off-loading and HTTP compression off-loading.My application is running on...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.