By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,659 Members | 910 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,659 IT Pros & Developers. It's quick & easy.

Open Word Document from a Dialog Web Page

P: n/a
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
Share this Question
Share on Google+
7 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.