472,794 Members | 1,850 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Open Word Document from a Dialog Web Page

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);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
but I am getting the following error message.

Unable to evaluate expression because the code is optimized or a native
frame is on top of the call stack.
Thank You
Peter
Jun 27 '08 #1
7 3931
Hi Peter,

Regarding on the open excel file in dialog page issue, would you provide
some further information such as how to open the dialog page and whether
the dialog page's url is the page that write out excel file or if the
dialog page want to open another page that write out excel file?

Based on my understanding, if the dialog page directy point to the excel
page, it may cause problem due to the client-side browser's dialog model.
Is there any particular requirement that you need to open excel file in
dialog pgae?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "Peter" <cz****@nospam.nospam>
Subject: Open Word Document from a Dialog Web Page
Date: Wed, 30 Apr 2008 23:00:55 -0500
>
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);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
but I am getting the following error message.

Unable to evaluate expression because the code is optimized or a native
frame is on top of the call stack.
Thank You
Peter
Jun 27 '08 #2
I have a dialog page and on that page is a submitt button, when a user
clicks on the submit button I want to open a Word or Excel file.
The Word or Excel file already exitst on the web server.

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:7k**************@TK2MSFTNGHUB02.phx.gbl...
Hi Peter,

Regarding on the open excel file in dialog page issue, would you provide
some further information such as how to open the dialog page and whether
the dialog page's url is the page that write out excel file or if the
dialog page want to open another page that write out excel file?

Based on my understanding, if the dialog page directy point to the excel
page, it may cause problem due to the client-side browser's dialog model.
Is there any particular requirement that you need to open excel file in
dialog pgae?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
>>From: "Peter" <cz****@nospam.nospam>
Subject: Open Word Document from a Dialog Web Page
Date: Wed, 30 Apr 2008 23:00:55 -0500
>>
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);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
but I am getting the following error message.

Unable to evaluate expression because the code is optimized or a native
frame is on top of the call stack.
Thank You
Peter

Jun 27 '08 #3
Are you attempting to execute any code after the Response.End()?

--
---------------------------------------------------
S.M. Altaf [MVP]
http://www.mendhak.com/
"Peter" <cz****@nospam.nospamwrote in message
news:Om**************@TK2MSFTNGP06.phx.gbl...
I have a dialog page and on that page is a submitt button, when a user
clicks on the submit button I want to open a Word or Excel file.
The Word or Excel file already exitst on the web server.

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:7k**************@TK2MSFTNGHUB02.phx.gbl...
>Hi Peter,

Regarding on the open excel file in dialog page issue, would you provide
some further information such as how to open the dialog page and whether
the dialog page's url is the page that write out excel file or if the
dialog page want to open another page that write out excel file?

Based on my understanding, if the dialog page directy point to the excel
page, it may cause problem due to the client-side browser's dialog model.
Is there any particular requirement that you need to open excel file in
dialog pgae?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

================================================= =
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

================================================= =
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
>>>From: "Peter" <cz****@nospam.nospam>
Subject: Open Word Document from a Dialog Web Page
Date: Wed, 30 Apr 2008 23:00:55 -0500
>>>
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);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
but I am getting the following error message.

Unable to evaluate expression because the code is optimized or a native
frame is on top of the call stack.
Thank You
Peter

Jun 27 '08 #4
Yes, but the error occurs on the Response.End();

"S.M. Altaf [MVP]" <sm*****@mNOSPAMsn.comwrote in message
news:AF**********************************@microsof t.com...
Are you attempting to execute any code after the Response.End()?

--
---------------------------------------------------
S.M. Altaf [MVP]
http://www.mendhak.com/
"Peter" <cz****@nospam.nospamwrote in message
news:Om**************@TK2MSFTNGP06.phx.gbl...
>I have a dialog page and on that page is a submitt button, when a user
clicks on the submit button I want to open a Word or Excel file.
The Word or Excel file already exitst on the web server.

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:7k**************@TK2MSFTNGHUB02.phx.gbl...
>>Hi Peter,

Regarding on the open excel file in dialog page issue, would you provide
some further information such as how to open the dialog page and whether
the dialog page's url is the page that write out excel file or if the
dialog page want to open another page that write out excel file?

Based on my understanding, if the dialog page directy point to the excel
page, it may cause problem due to the client-side browser's dialog
model.
Is there any particular requirement that you need to open excel file in
dialog pgae?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments
and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

================================================ ==
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

================================================ ==
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
From: "Peter" <cz****@nospam.nospam>
Subject: Open Word Document from a Dialog Web Page
Date: Wed, 30 Apr 2008 23:00:55 -0500
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);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
but I am getting the following error message.

Unable to evaluate expression because the code is optimized or a native
frame is on top of the call stack.
Thank You
Peter



Jun 27 '08 #5
Can u post the stack trace of the error?

"Peter" <cz****@nospam.nospamwrote in message
news:On*************@TK2MSFTNGP02.phx.gbl...
Yes, but the error occurs on the Response.End();

"S.M. Altaf [MVP]" <sm*****@mNOSPAMsn.comwrote in message
news:AF**********************************@microsof t.com...
>Are you attempting to execute any code after the Response.End()?

--
---------------------------------------------------
S.M. Altaf [MVP]
http://www.mendhak.com/
"Peter" <cz****@nospam.nospamwrote in message
news:Om**************@TK2MSFTNGP06.phx.gbl...
>>I have a dialog page and on that page is a submitt button, when a user
clicks on the submit button I want to open a Word or Excel file.
The Word or Excel file already exitst on the web server.

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:7k**************@TK2MSFTNGHUB02.phx.gbl.. .
Hi Peter,

Regarding on the open excel file in dialog page issue, would you
provide
some further information such as how to open the dialog page and
whether
the dialog page's url is the page that write out excel file or if the
dialog page want to open another page that write out excel file?

Based on my understanding, if the dialog page directy point to the
excel
page, it may cause problem due to the client-side browser's dialog
model.
Is there any particular requirement that you need to open excel file in
dialog pgae?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments
and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

=============================================== ===
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

=============================================== ===
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
>From: "Peter" <cz****@nospam.nospam>
>Subject: Open Word Document from a Dialog Web Page
>Date: Wed, 30 Apr 2008 23:00:55 -0500

>
>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);
>Response.AddHeader("Content-Length", file.Length.ToString());
>Response.ContentType = "application/octet-stream";
>Response.WriteFile(file.FullName);
>Response.End();
>
>
>but I am getting the following error message.
>
>Unable to evaluate expression because the code is optimized or a native
>frame is on top of the call stack.
>
>
>Thank You
>
>
>Peter
>
>
>


Jun 27 '08 #6
Hi Peter,

Does the problem definite occur? Based on my test, though the modal dialog
may not display the output word/excel document correct, it will not report
exception at server-side(the Response.End code should get executed
correctly). Is it also specific to a certain office document? You can try
write out a very simple word or excel document to see whether the problem
occurs.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
>From: "Peter" <cz****@nospam.nospam>
References: <u8**************@TK2MSFTNGP02.phx.gbl>
<7k**************@TK2MSFTNGHUB02.phx.gbl>
<Om**************@TK2MSFTNGP06.phx.gbl>
<AF**********************************@microsoft.co m>
>Subject: Re: Open Word Document from a Dialog Web Page
Date: Thu, 1 May 2008 14:56:39 -0500
>Yes, but the error occurs on the Response.End();

"S.M. Altaf [MVP]" <sm*****@mNOSPAMsn.comwrote in message
news:AF**********************************@microso ft.com...
>Are you attempting to execute any code after the Response.End()?

--
---------------------------------------------------
S.M. Altaf [MVP]
http://www.mendhak.com/
"Peter" <cz****@nospam.nospamwrote in message
news:Om**************@TK2MSFTNGP06.phx.gbl...
>>I have a dialog page and on that page is a submitt button, when a user
clicks on the submit button I want to open a Word or Excel file.
The Word or Excel file already exitst on the web server.

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:7k**************@TK2MSFTNGHUB02.phx.gbl.. .
Hi Peter,

Regarding on the open excel file in dialog page issue, would you
provide
>>>some further information such as how to open the dialog page and
whether
>>>the dialog page's url is the page that write out excel file or if the
dialog page want to open another page that write out excel file?

Based on my understanding, if the dialog page directy point to the
excel
>>>page, it may cause problem due to the client-side browser's dialog
model.
Is there any particular requirement that you need to open excel file in
dialog pgae?

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments
and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

=============================================== ===
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
>>>ications.

=============================================== ===
This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
>From: "Peter" <cz****@nospam.nospam>
>Subject: Open Word Document from a Dialog Web Page
>Date: Wed, 30 Apr 2008 23:00:55 -0500

>
>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);
>Response.AddHeader("Content-Length", file.Length.ToString());
>Response.ContentType = "application/octet-stream";
>Response.WriteFile(file.FullName);
>Response.End();
>
>
>but I am getting the following error message.
>
>Unable to evaluate expression because the code is optimized or a native
>frame is on top of the call stack.
>
>
>Thank You
>
>
>Peter
>
>
>


Jun 27 '08 #7
I've used iframe instead and it works fine.

string officeDocScript = "<div>"
+ "<iframe width=\"75%\" height=\"55%\" name=\"fframe\" src=\"" +
filePath + "\">"
+ "<embed src=\"" + filePath + "\">"
+ "</iframe></div>";
"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:XO**************@TK2MSFTNGHUB02.phx.gbl...
Hi Peter,

Does the problem definite occur? Based on my test, though the modal dialog
may not display the output word/excel document correct, it will not report
exception at server-side(the Response.End code should get executed
correctly). Is it also specific to a certain office document? You can try
write out a very simple word or excel document to see whether the problem
occurs.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

This posting is provided "AS IS" with no warranties, and confers no
rights.

--------------------
>>From: "Peter" <cz****@nospam.nospam>
References: <u8**************@TK2MSFTNGP02.phx.gbl>
<7k**************@TK2MSFTNGHUB02.phx.gbl>
<Om**************@TK2MSFTNGP06.phx.gbl>
<AF**********************************@microsoft.co m>
>>Subject: Re: Open Word Document from a Dialog Web Page
Date: Thu, 1 May 2008 14:56:39 -0500
>>Yes, but the error occurs on the Response.End();

"S.M. Altaf [MVP]" <sm*****@mNOSPAMsn.comwrote in message
news:AF**********************************@micros oft.com...
>>Are you attempting to execute any code after the Response.End()?

--
---------------------------------------------------
S.M. Altaf [MVP]
http://www.mendhak.com/
"Peter" <cz****@nospam.nospamwrote in message
news:Om**************@TK2MSFTNGP06.phx.gbl...
I have a dialog page and on that page is a submitt button, when a user
clicks on the submit button I want to open a Word or Excel file.
The Word or Excel file already exitst on the web server.

"Steven Cheng [MSFT]" <st*****@online.microsoft.comwrote in message
news:7k**************@TK2MSFTNGHUB02.phx.gbl. ..
Hi Peter,
>
Regarding on the open excel file in dialog page issue, would you
provide
>>>>some further information such as how to open the dialog page and
whether
>>>>the dialog page's url is the page that write out excel file or if the
dialog page want to open another page that write out excel file?
>
Based on my understanding, if the dialog page directy point to the
excel
>>>>page, it may cause problem due to the client-side browser's dialog
model.
Is there any particular requirement that you need to open excel file
in
dialog pgae?
>
Sincerely,
>
Steven Cheng
>
Microsoft MSDN Online Support Lead
>
>
Delighting our customers is our #1 priority. We welcome your comments
and
suggestions about how we can improve the support we provide to you.
Please
feel free to let my manager know what you think of the level of
service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.
>
============================================== ====
Get notification to my posts through email? Please refer to
>
http://msdn.microsoft.com/subscripti...ult.aspx#notif
>>>>ications.
>
============================================== ====
This posting is provided "AS IS" with no warranties, and confers no
rights.
>
--------------------
>>From: "Peter" <cz****@nospam.nospam>
>>Subject: Open Word Document from a Dialog Web Page
>>Date: Wed, 30 Apr 2008 23:00:55 -0500
>
>>
>>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);
>>Response.AddHeader("Content-Length", file.Length.ToString());
>>Response.ContentType = "application/octet-stream";
>>Response.WriteFile(file.FullName);
>>Response.End();
>>
>>
>>but I am getting the following error message.
>>
>>Unable to evaluate expression because the code is optimized or a
>>native
>>frame is on top of the call stack.
>>
>>
>>Thank You
>>
>>
>>Peter
>>
>>
>>
>




Jun 27 '08 #8

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

Similar topics

3
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...
8
by: sudha | last post by:
Hi, To open a word doc from c#, i use the following code : Word.ApplicationClass WordApp = new Word.ApplicationClass (); // give any file name of your choice. object fileName =...
2
by: Jonathan Trevor | last post by:
Hi, For the last couple of releases of a product we're developing we've been running to very wierd behavior from IE and our ASP.NET web application which serves up various types of files and I'm...
10
by: Åženol Akbulak | last post by:
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.ContentType =...
6
by: Michael Groeger | last post by:
Hi, I have an aspx page which generates an excel document and transfers it to the browser as attachment. Normally, once the document is transferred the open save dialog prompts to open or save...
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: ppardi | last post by:
I'm developing an addin for Word 2007 and I need to determine whether a user saves a Word 2007 document in an older format (97-2003) after a save as is done. The scenario is that the user starts...
7
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...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.