473,626 Members | 3,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2725
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.Cur rent.Response.C ontentType = "applicatio n/ms-word";
HttpContext.Cur rent.Response.A ppendHeader("Co ntent-Disposition",
"attachment ; filename=myWord Doc.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.ClearC ontent();
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter( sw);
htw.Write(SOMEW ORDTEXT);
HttpContext.Cur rent.Response.C ontentType = "applicatio n/ms-word";
HttpContext.Cur rent.Response.C ontentEncoding =
System.Text.Uni codeEncoding.UT F8;
HttpContext.Cur rent.Response.C harset = "UTF-8";
Response.AddHea der("Content-Disposition", attachment);
Response.Write( @"<html xmlns:o=""urn:s chemas-microsoft-
com:office:offi ce"" xmlns:w=""urn:s chemas-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.Do cument>");
Response.Write( @"<meta name=Generator content=""Micro soft Word
11"">");
Response.Write( @"<meta name=Originator content=""Micro soft Word
11"">");
Response.Write( @"<link rel=File-List href=""Doc1_fil es/
filelist.xml""> ");
Response.Write( "<!--[if gte mso 9]><xml<o:Documen tProperties>
<o:Author</o:Author <o:LastAuthor </o:LastAuthor <o:Revision>1 </
o:Revision <o:TotalTime> 1</o:TotalTime>
<o:Created>20 08-05-13T17:47:00Z</o:Created>
<o:LastSaved>20 08-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.9 999</o:Version</o:DocumentPrope rties></
xml><![endif]-->");
Response.Write( "<!--[if gte mso 9]><xml<w:WordDoc ument>
<w:View>Print </w:View <w:DisplayBackg roundShape/>
<w:SpellingStat e>Clean</w:SpellingState <w:GrammarState >Clean</
w:GrammarState <w:PunctuationK erning/ <w:ValidateAgai nstSchemas/>
<w:SaveIfXMLInv alid>false</w:SaveIfXMLInva lid>
<w:IgnoreMixedC ontent>false</w:IgnoreMixedCo ntent>
<w:AlwaysShowPl aceholderText>f alse</w:AlwaysShowPla ceholderText>
<w:Compatibilit y <w:BreakWrapped Tables/ <w:SnapToGridIn Cell/>
<w:WrapTextWith Punct/ <w:UseAsianBrea kRules/ <w:DontGrowAuto fit/
</w:Compatibility <w:BrowserLevel >MicrosoftInter netExplorer4</
w:BrowserLevel</w:WordDocument> </xml><![endif]-->");
Response.Write( @"<!--[if gte mso 9]><xml<w:LatentS tyles
DefLockedState= ""false"" LatentStyleCoun t=""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:53687 1559 0
0 0 415 0;}p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-
parent:""""; margin:0in; margin-bottom:.0001pt; mso-
pagination:wido w-orphan; font-size:8.0pt; font-family:""Verdan a"";
mso-fareast-font-family:""Verdan a"";}@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.S ection1
{page:Section1; }--></style>");
Response.Write( @"<!--[if gte mso 10]><styletable.Ms oNormalTable
{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:wido w-orphan; font-size:
8.0pt; font-family:""Verdan a""; 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...@discussio ns.microsoft.co mwrote:
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.Cur rent.Response.C ontentType = "applicatio n/ms-word";
HttpContext.Cur rent.Response.A ppendHeader("Co ntent-Disposition",
"attachment ; filename=myWord Doc.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
6288
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 only when I create a shortcut for the document. However a pop-up comes up with save and/or open instructions. I do not want the pop-up to come up. Mike
0
1234
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 (amongst other things) before passing the document back to the client. What seems to be happening is that, when the ASP sets a content-type of
4
11127
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 done this? Does it seem possible? I followed the instructions from a sample on the Microsoft knowledge base but it only seems to work when creating a VB.NET Windows .EXE, not an VB.NET ASP app.
12
1937
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 = "application/x-msdownload" Response.AddHeader("Content-Disposition", "attachment; filename=" & System.IO.Path.GetFileName(FilePath)) Response.AddHeader("Content-Length", File.Length.ToString()) Response.WriteFile(FilePath) Response.End()
0
1221
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 Response.AddHeader("Content-Disposition", "Report.doc") and render the HTML.
2
2509
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 template. The user will then be asked whether to save as or open the word document on his client machine. Question1)Is there a way to manipulate the word document in memory
2
3040
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 if the operating system is win2000 but when i'm opening it in windows(XP/2003) it is saying that document not found. please try to solve my problem asap.
0
1798
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 the reports in an OLE object field in the MS Access database. Using ASP, I can get the report to dump its contents in binary into an html table in the browser using response.binarywrite, but I can find no way of letting the end user either view the...
6
3758
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 .NET 1.1, IIS 6, Win2003. Now we are having problem when trying to download word documents located in the file server. It often says Internet Explorer cannot download <filenamefrom <servername>. Sometimes we are able to view
0
8268
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8202
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8707
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8641
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7199
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5575
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2628
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.