Hi,
I have a form page to print on my web application(asp .net). I want to show
the page in WORD. I use that code in asp.net Page_Load event:
Response.Clear( );
Response.Conten tType = "applicatio n/ms-word";
Response.AddHea der("Content-Disposition", "attachment;fil ename=word.doc" );
When I open the page in IE shows a dialog to ask whether I want to open or
save. It is ok. But when I click Open or Save button, I get an error message:
"
Internet Explorer cannot download form.aspx.
Internet Explorer was not able to open this Internet site. The requested
site is either unavailable or cannot be found. Please try again later.
"
What can I do to solve this problem?
Thanks in advance.
--
_______________ _______________
Åženol Akbulak 10 2646
"Senol Akbulak" <se**********@n ewsgroup.nospam > wrote in message
news:26******** *************** ***********@mic rosoft.com... Hi,
I have a form page to print on my web application(asp .net). I want to show the page in WORD. I use that code in asp.net Page_Load event: Response.Clear( ); Response.Conten tType = "applicatio n/ms-word"; Response.AddHea der("Content-Disposition", "attachment;fil ename=word.doc" );
When I open the page in IE shows a dialog to ask whether I want to open or save. It is ok. But when I click Open or Save button, I get an error message: " Internet Explorer cannot download form.aspx. Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later. "
What can I do to solve this problem?
hmm, it looks as if you are doing the right thing.
I presume you are streaming the binary contents of a word document directly
after setting these headers. Have you checked the document itself is being
sent correctly.
you could also try putting in a content-length header but I wouldn't have
thought this was necessary.
Thanks in advance.
-- _______________ _______________ Senol Akbulak
My form content is for html. Is the problem that?
Cannot Word open html content?
"Andy Fish" wrote: "Senol Akbulak" <se**********@n ewsgroup.nospam > wrote in message news:26******** *************** ***********@mic rosoft.com... Hi,
I have a form page to print on my web application(asp .net). I want to show the page in WORD. I use that code in asp.net Page_Load event: Response.Clear( ); Response.Conten tType = "applicatio n/ms-word"; Response.AddHea der("Content-Disposition", "attachment;fil ename=word.doc" );
When I open the page in IE shows a dialog to ask whether I want to open or save. It is ok. But when I click Open or Save button, I get an error message: " Internet Explorer cannot download form.aspx. Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later. "
What can I do to solve this problem?
hmm, it looks as if you are doing the right thing.
I presume you are streaming the binary contents of a word document directly after setting these headers. Have you checked the document itself is being sent correctly.
you could also try putting in a content-length header but I wouldn't have thought this was necessary.
Thanks in advance.
-- _______________ _______________ Senol Akbulak
hmm,
Well, word can certainly open an HTML file, but I wouldn't be at all
surprised if streaming HTML content to the browser with a content-type of
word didn't work.
Bear in mind that with content type you are supposed to be telling the
browser what type of file you are sending, and the browser is in charge of
deciding which application to use. There is no way in HTTP of saying "here's
some HTML, open it with word".
Andy
"Senol Akbulak" <se**********@n ewsgroup.nospam > wrote in message
news:8A******** *************** ***********@mic rosoft.com... My form content is for html. Is the problem that? Cannot Word open html content?
"Andy Fish" wrote:
"Senol Akbulak" <se**********@n ewsgroup.nospam > wrote in message news:26******** *************** ***********@mic rosoft.com... > Hi, > > I have a form page to print on my web application(asp .net). I want to > show > the page in WORD. I use that code in asp.net Page_Load event: > Response.Clear( ); > Response.Conten tType = "applicatio n/ms-word"; > Response.AddHea der("Content-Disposition", > "attachment;fil ename=word.doc" ); > > When I open the page in IE shows a dialog to ask whether I want to open > or > save. It is ok. But when I click Open or Save button, I get an error > message: > " > Internet Explorer cannot download form.aspx. > Internet Explorer was not able to open this Internet site. The > requested > site is either unavailable or cannot be found. Please try again later. > " > > What can I do to solve this problem? >
hmm, it looks as if you are doing the right thing.
I presume you are streaming the binary contents of a word document directly after setting these headers. Have you checked the document itself is being sent correctly.
you could also try putting in a content-length header but I wouldn't have thought this was necessary.
> Thanks in advance. > > -- > _______________ _______________ > Senol Akbulak
Hi Senol,
I think Andy's suggestions are reasonable. Though WORD can open HTML
document correcdtly. The IE browser will check the mime-type of the
response stream first. If we output an HTML document but set the content
Type as word, that'll cause the problem. So I suggest you consider the
following options:
1. Convert the content to word compatible document (word or normal rtf)
2. Use text/html as the response's content Type. We can use
Response.AddHea der("Content-Disposition", "attachment;fil ename=xxxx");
to let the document be opened outside, but whether it'll be opened through
Word.exe will depened on the clientside's settings.
Please feel free to post here if you have any further questions. Thanks,
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Hi Steven,
I sorry, I just realized your answer.
I tried your second suggest, but I still get the same error message.
"Steven Cheng[MSFT]" wrote: Hi Senol,
I think Andy's suggestions are reasonable. Though WORD can open HTML document correcdtly. The IE browser will check the mime-type of the response stream first. If we output an HTML document but set the content Type as word, that'll cause the problem. So I suggest you consider the following options: 1. Convert the content to word compatible document (word or normal rtf)
2. Use text/html as the response's content Type. We can use
Response.AddHea der("Content-Disposition", "attachment;fil ename=xxxx");
to let the document be opened outside, but whether it'll be opened through Word.exe will depened on the clientside's settings.
Please feel free to post here if you have any further questions. Thanks,
Regards,
Steven Cheng Microsoft Online Support
Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.)
Thanks for your followup Senol,
Well, I'm not sure whether there is something incorrect on your server's
asp.net/iis environment. But is it ok for you to simple use
Response.WriteF ile to output an existing word or excel document. For
example:
private void btnZIP_Click(ob ject sender, System.EventArg s e)
{
Response.Clear( );
Response.Conten tType="applicat ion/msword";
Response.AddHea der("content-disposition","a ttachment; filename=mydoc. doc");
Response.WriteF ile(Server.MapP ath("~/files/mydoc.doc"));
Response.End();
}
If even this not work, I'm fraid there must be some environment specific
problems we need to troubleshooting .
Thanks,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Thank you at all!!!
I found the problem. The problem was that:
############### ############### ##########
Response.Cache. SetCacheability (HttpCacheabili ty.NoCache);
############### ############### ##########
After deleting this line, it run successfully.
Thanks.
"Steven Cheng[MSFT]" wrote: Thanks for your followup Senol,
Well, I'm not sure whether there is something incorrect on your server's asp.net/iis environment. But is it ok for you to simple use Response.WriteF ile to output an existing word or excel document. For example:
private void btnZIP_Click(ob ject sender, System.EventArg s e) { Response.Clear( ); Response.Conten tType="applicat ion/msword"; Response.AddHea der("content-disposition","a ttachment; filename=mydoc. doc"); Response.WriteF ile(Server.MapP ath("~/files/mydoc.doc")); Response.End(); }
If even this not work, I'm fraid there must be some environment specific problems we need to troubleshooting .
Thanks,
Steven Cheng Microsoft Online Support
Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.)
Thanks for your followup.
I'm glad that everything works well now.
Have a good day!
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Hi There!
I followed the same method to open a web form report page in MS word.
How do I automate the Open [to avoid the file download dialog - would
you like to open the file or save it to your disk?]
Your help is greatly appreciated!
John
*** Sent via Developersdex http://www.developersdex.com *** This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Martin Lucas-Smith |
last post by:
I am trying to use PHP's COM support to open a URL from within MS Word
then save the document.
I am using PHP5.0.3/Apache2/WindowsXP. phpinfo() confirms that COM support
is enabled.
Manually, this would be:
- Start MS Word (am using Office 2003)
|
by: monika |
last post by:
Hi all...
I am able to select a student's story and open it in a word doc. the
teacher then corrects the story, highlight in colors the comments,
strikethrough. In fact all the privileges I wanted as an editor can be
achieved. This word doc gets opened in a new window ... the best part
now I have 2 buttons on a page. One which would open a separate window to a
word doc and another I want it to open in another asp page. since I have...
|
by: TLMM |
last post by:
I have a Word doc already created that I want to open from an asp page. I
want it to open in Word and allow the user to modify if necessary. I
currently have it opening (using href), but it is opening in IE. I think I
should be able to do it with javascript to open word and then call that
function on the link to the doc. Can someone give me some pointers?
Thanks in advance.
|
by: Andrew |
last post by:
I'm adding this as it to me a while to figure out all the pieces to be
able to do this without using Microsoft.Office.Interop which caused me
problems on the web-server.
Streaming is the easy part, but I couldn't initially work out how to
manipulate the page setup to change page margins and orientation,
that's why I was looking at Microsoft.Office.Interop.
But with Microsoft.Office.Interop I couldn't fiure out how to stream
HTML...
|
by: bhoff |
last post by:
I have a program where a user can click on a LinkLabel to open a word
document to view a reference. I can't figure out how to make word jump
to a specified page though, example:
A reference to test.doc, page 13 is where the user needs to find a
reference from
Dim wd as new microsoft.office.interop.word.application = new
microsoft.office.interop.word.application
Dim wdDoc as microsoft.office.interop.word.document
| |
by: =?Utf-8?B?UmF2aQ==?= |
last post by:
public WordApp()
{
//oWordAppl = new
Microsoft.Office.Interop.Word.ApplicationClass();
}
When I click a button in my aspx file I geet the followign error. I am
trying to open word from server side (Word is also isntalled in windows2003
server)
Retrieving the COM class factory for component with CLSID
|
by: Peter |
last post by:
ASP.NET 2.0
I am trying to open a Word document and Excel document from a dialog web
page, what's the best way to do that?
I have tried the following:
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" +
file.Name);
|
by: Peter |
last post by:
I have the following code which is executed from a modal web page - it works
fine on most, but on some computers the Word loads into memory but never
displays. This occurs with IE6 and IE7, but always works on FireFox.
When I close the modal web page Word disappears from Memory.
I don't know where the problem is, my code, IE setup or intranet security, I
also do not know where and for what to look for - I've tried Google but I
don't know...
|
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...
|
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,...
|
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...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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...
|
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();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
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
| |