473,326 Members | 2,111 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,326 software developers and data experts.

Excel Problem

Hi,
I have a ASP.net application which takes excel sheet as input.It retrieves
the data from the excel sheet and using that data it generates reports.
On my PC everything is working fine.But if somebody access my application
other than localhost,i.e something like
http://MyMachinename/MyapplicationName/Report.aspx
application is throwing the error "Rejected Safe Mode action : Microsoft
Office Excel."

I'm using code like this
Imports Excel = Microsoft.Office.Interop.Excel
Dim objExcel As Excel.Application
Dim objExcelWorkBook As Excel.Workbook
Dim objExcelWorkSheet As Excel.Worksheet

Can anybody please help me in resolving this?

Thanks in advance
Dec 4 '06 #1
5 4478
Do you have all the interop assemblies loaded on the server? Using Excel
server-side is still troublesome at best and highly problematic. If you're
just querying the spreadsheets, have to tried simply opening a database
connection to the spreadsheet? A lot of people don't think of using Excel as
a datasource just like any other database, but it's possible. Check out
http://www.connectionstrings.com/ for the proper way to connect to it.
--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"srinivas" <sr******@discussions.microsoft.comwrote in message
news:70**********************************@microsof t.com...
Hi,
I have a ASP.net application which takes excel sheet as input.It retrieves
the data from the excel sheet and using that data it generates reports.
On my PC everything is working fine.But if somebody access my application
other than localhost,i.e something like
http://MyMachinename/MyapplicationName/Report.aspx
application is throwing the error "Rejected Safe Mode action : Microsoft
Office Excel."

I'm using code like this
Imports Excel = Microsoft.Office.Interop.Excel
Dim objExcel As Excel.Application
Dim objExcelWorkBook As Excel.Workbook
Dim objExcelWorkSheet As Excel.Worksheet

Can anybody please help me in resolving this?

Thanks in advance


Dec 4 '06 #2
Hi,

Mark Fitzpatrick wrote:
Do you have all the interop assemblies loaded on the server? Using Excel
server-side is still troublesome at best and highly problematic. If you're
just querying the spreadsheets, have to tried simply opening a database
connection to the spreadsheet? A lot of people don't think of using Excel as
a datasource just like any other database, but it's possible. Check out
http://www.connectionstrings.com/ for the proper way to connect to it.
I concur, using Excel as a DB works fine. I have a code example here:

http://geekswithblogs.net/lbugnion/a...006/08/25.aspx

HTH,
Laurent
--
Laurent Bugnion, GalaSoft
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Dec 4 '06 #3
"srinivas" <sr******@discussions.microsoft.comwrote in message
news:70**********************************@microsof t.com...
Imports Excel = Microsoft.Office.Interop.Excel
Dim objExcel As Excel.Application
This is without doubt one of the worst things you can do in terms of
scalability, performance and robustness. Microsoft themselves not only
strongly advise against it but they will also not support any solution which
uses it: http://support.microsoft.com/default...US;q257757#kb2

You've already encountered the first major problem - I'm afraid it's only
likely to get worse...

There are several options:

1) As others have suggested, consider using ADO.NET to treat the Excel
worksheet as any other relational data source

2) Use a 3rd-party tool like this:
http://www.aspose.com/Products/Aspos...s/Default.aspx Also, you would do
well to have a read of their "Why Not Automation" page.

3) If the Excel spreadsheets can be saved in XML format first, they can be
consumed by ASP.NET just like any other XML document
Dec 4 '06 #4
Hi Mark,
Thanks for the reply.
Yes, i'm using the following OLDDBConnection string for the excel.

Dim xlconn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Extended
Properties=""Excel 8.0;HDR=Yes;IMEX=1"";Data Source=" + filePath + "").

When i'm running through VS.net IDE i'm not getting any error.But if i'm
accessing through other machine.I'm getting the error "Rejected Safe Mode
action : Microsoft
Office Excel."
The DLLs for Microsoft.Office.Interop.Excel is under GAC.

Thanks
Srinivas
"Mark Fitzpatrick" wrote:
Do you have all the interop assemblies loaded on the server? Using Excel
server-side is still troublesome at best and highly problematic. If you're
just querying the spreadsheets, have to tried simply opening a database
connection to the spreadsheet? A lot of people don't think of using Excel as
a datasource just like any other database, but it's possible. Check out
http://www.connectionstrings.com/ for the proper way to connect to it.
--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006

"srinivas" <sr******@discussions.microsoft.comwrote in message
news:70**********************************@microsof t.com...
Hi,
I have a ASP.net application which takes excel sheet as input.It retrieves
the data from the excel sheet and using that data it generates reports.
On my PC everything is working fine.But if somebody access my application
other than localhost,i.e something like
http://MyMachinename/MyapplicationName/Report.aspx
application is throwing the error "Rejected Safe Mode action : Microsoft
Office Excel."

I'm using code like this
Imports Excel = Microsoft.Office.Interop.Excel
Dim objExcel As Excel.Application
Dim objExcelWorkBook As Excel.Workbook
Dim objExcelWorkSheet As Excel.Worksheet

Can anybody please help me in resolving this?

Thanks in advance


Dec 4 '06 #5
hejdig.

Is it a path problem? Do you use <input type="file... and read the file as
a stream?

FWIW

/OF

-----8<------

"srinivas" <sr******@discussions.microsoft.comwrote in message
news:70**********************************@microsof t.com...
Hi,
I have a ASP.net application which takes excel sheet as input.It retrieves
the data from the excel sheet and using that data it generates reports.
On my PC everything is working fine.But if somebody access my application
other than localhost,i.e something like
http://MyMachinename/MyapplicationName/Report.aspx
application is throwing the error "Rejected Safe Mode action : Microsoft
Office Excel."

I'm using code like this
Imports Excel = Microsoft.Office.Interop.Excel
Dim objExcel As Excel.Application
Dim objExcelWorkBook As Excel.Workbook
Dim objExcelWorkSheet As Excel.Worksheet

Can anybody please help me in resolving this?

Thanks in advance


Dec 4 '06 #6

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

Similar topics

8
by: mytfein | last post by:
Hi Everyone, Background: Another department intends to ftp a .txt file from the mainframe, for me to process. The objective is to write a vb script that would be scheduled to run daily to...
0
by: Mike Knight | last post by:
(I've also posted this problem on microsoft.public.excel.programming) I have a MS Access 2003 Database named "AS400 Fields.mdb". This database contains links to tables on an AS400. In MS...
2
by: Praveen K | last post by:
I have a problem in communicating between the C# and the Excel Interop objects. The problem is something as described below. I use Microsoft Office-XP PIA dll’s as these dll’s were been...
0
by: rhett | last post by:
howdy folks, first off, I'd like to not that I have browsed the forums and thanks to what I've found there I'm 80% through this problem, but the last part seems to be a profound obstacle and any...
4
by: msnnews.msn.com | last post by:
hi there, i've got a form that populates a datagrid, and a button that calls a function to export to an excel file. All is well with the export, no errors are returned, but the Excel instance...
18
by: lgbjr | last post by:
Hi All, I have a VB.NET app that, among other things, writes data to Excel. I am having trouble getting the Excel process to terminate after I quit Excel. I found an article related to this...
1
by: Randall Arnold | last post by:
I'm converting a vbscript program to vb.net. Witht he exception of .net idiosyncrasies, most of it is working well with the same code. My only problem is that some properties and methods are...
6
by: Darrell Wesley | last post by:
A VB2003 application upgraded to VB2005 that builds an Excel spreadsheet. Everything appears to work correctly except that the Excel object does not go away it is still in the Process list in task...
2
by: James | last post by:
I am doing some Excel 2000 automaton using Vb 2005. I am referencing the Excel 9.0 COM Object Library. The following code was working fine: Dim xlApp as new Excel.Application Dim xlWb as...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.