How can I call ActiveX (e.g. Excel) from ASP.NET?

D

dfaherty

I have a 3rd party application that has an ActiveX interface. For argument,
lets say that it is Excel.

I want a user to make a request (through the web browser), have the request
be processed by the server where Excel is installed (and the .xls exists),
and return some information. The server side should open an Excel
spreadsheet, do some calculations, and then return something to the user.

I am able to make these ActiveX calls in a VB.NET Windows Application.

However, when I create a ASP.NET Web application, I get a run time error
(usually "Object variable or with block not set").

I have been over the web and at Microsoft's pages for the last three weeks,
and I have not found anything that says I can't do it. See
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/callcomcomp.asp
for a description of how to do it from a windows application.

I tried creating a web service which would process the requests on the
server. I cannot get it to make ActiveX calls (compiles OK, get runtime
errors). Am I using the wrong tool (ASP.NET)? Is it a permissions thing? I
found an article that uses DCOMCNFG.EXE to explicity give the ASPNET user
launch rights for Excel. Of course, this 3rd party application does not
appear in the list of Component Services.

I have set the browser security to the lowest to allow ActiveX to run, but
that didn't help either. I have Microsoft Developer Environment 2002.

Thanks!
Dennis
 
D

Dennis Faherty

The problem is with permissions for the ASPNET user.

You will often get the error
Procedure call or argument is not valid.

To access COM and ActiveX automation on the server side from the web, the
ASPNET user must have permissions to launch the COM object. For Excel,
configure this with DCOMCNFG.EXE (see
http://www.asp101.com/articles/jayram/exceldotnet/default.asp for a good
example with code.)

To use a 3rd party DLL, you must give explicit permissions to the ASPNET
user (or use impersonation).
See http://bdn.borland.com/article/0,1410,26048,00.html for a related problem.

Basically, use OLEVIEW.EXE, locate the DLL you want to enable in the
Automation Objects list, and

add ASPNET to the launch permissions and access permissions tabs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top