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

Discussion in 'ASP .Net Web Services' started by dfaherty, Dec 9, 2004.

  1. dfaherty

    dfaherty Guest

    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
    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.

    dfaherty, Dec 9, 2004
    1. Advertisements

  2. 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 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,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.
    Dennis Faherty, Dec 10, 2004
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
  2. Replies:
  3. Steve Kershaw
    Jul 17, 2007
  4. vml
  5. =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=

    Problem with Excel reports ::::Excel 2003 Migration To Excel 2007

    =?Utf-8?B?c2hhc2hhbmsga3Vsa2Fybmk=?=, Oct 5, 2007, in forum: ASP .Net
    Oct 24, 2007