CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 14 of 14
  1. #1
    Join Date
    Aug 2002
    Posts
    11

    Question OLE automation in javascript (automation server cannot create object)

    I'm trying to instantiate an excel object through ole automation in client-side javascript using.

    var obj = new ActiveXObject(Excel.Application);

    It is working fine if I run this simple .htm file, with client-side javascript code, from local C or D drive. but when i place this file on wwwroot, an exception occurs, "automation server cannot create object" at the obove mentioned line.

    So is this a problem with some permission required for IIS to create an ole Object??. If this is so, Please respond for how to grant these permissions, or if it is a different problem?

    Thanks a lot.

  2. #2
    Join Date
    Jul 2002
    Location
    India
    Posts
    505
    The problem is not with IIS as IIS is not involved when your client side script is executing.

    You need to set the permissions for IE so that your script will execute. I am not sure of the exact change to be made.

    Check out in Tools -> Internet Options - >Security - > Custom level

    Satish

  3. #3
    Join Date
    Aug 2002
    Posts
    11
    The point is that when i run this script from a local C or D drive
    as C:\test.htm, it runs fine and creates the object perfactly.

    the thing is that if the problem is with IE, how is it doing fine this way.

    But when i place the same code at wwwroot, and try to request it from http://localhost/test.htm, the message says "automation server can't create object".

    Please respond to clear things up, and if you still think that the problem is with IE, kindly tell the exact procedure.

    Thanks a lot.

  4. #4
    Join Date
    Jul 2002
    Location
    India
    Posts
    505
    I get your point....

    This is because of IE's security mechanism, which allows for different securoty settings for Local intranet, internet, trusted sites etc. So when you are running the script from an HTML on your local disk, the browser considers this to be secure and allows it to run.

    When you run it from wwwroot, I guess it would come under local intranet and would have a different set of permissions.

    Unfortunately I can tell you the exact setting that you need to make as the organisation I work with locks the Internet Options menu for IE on our machines. So I cant try out and let you know.

    However, it should be quite easy to do.

    Satish

  5. #5
    Join Date
    Aug 2002
    Posts
    11
    Thanks a lot Satish

    It solved my problem.
    and thanks for making my concepts more clear.

  6. #6
    Join Date
    Apr 2003
    Location
    Syria
    Posts
    2

    Re: OLE automation in javascript (automation server cannot create object)

    Quote Originally Posted by farhanh
    Thanks a lot Satish

    It solved my problem.
    and thanks for making my concepts more clear.
    How did you solve the problem?

  7. #7
    Join Date
    Jun 2007
    Posts
    1

    Re: OLE automation in javascript (automation server cannot create object)

    Quote Originally Posted by imad1406
    How did you solve the problem?
    Hii ...

    would you tel me plz... how did u fix the problem.. for (automation server cannot create object)

    Thanks waiting for ur kind reply

  8. #8
    Join Date
    May 2002
    Posts
    10,943

    Re: OLE automation in javascript (automation server cannot create object)

    Welcome to the forums, ahmadriyaz. Please remember that when you have a problem, to create a new thread and post your problem. You will notice that the original poster wrote this 4 years ago. You will most likely not hear back from him.

    But, if you would have read the whole thread, you would have seen that the solution was given. You need to change security levels to a custom level when running on a web server due to security reasons. A script running on a local machine receives less security precautions.

    You can change these settings here.
    Code:
    Tools Menu -> Internet Options -> Security -> Custom level
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  9. #9
    Join Date
    Jan 2008
    Posts
    2

    Re: OLE automation in javascript (automation server cannot create object)

    hi,
    can you please give details on how u resolve this bug. i am getting same issue with my aspx page.

    please give which option i have to enable and disble after clicking on the customlevel in security tab.

    thanks...
    venkat.

  10. #10
    Join Date
    May 2002
    Posts
    10,943

    Re: OLE automation in javascript (automation server cannot create object)

    That all depends on what your scripts are attempting to run. Why don't you set them all really low, and then one-by-one move them up. Then you can eliminate which ones are necessary.

    You will need to focus on ActiveX components.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  11. #11
    Join Date
    Jan 2008
    Posts
    2

    Re: OLE automation in javascript (automation server cannot create object)

    thak you... i am checking the same way. let c how it goes..

  12. #12
    Join Date
    Apr 2008
    Posts
    1

    Re: OLE automation in javascript (automation server cannot create object)

    Just stumbled across this post and thought I'd post this in case anyone still needed it or someone new ran across it in the future... the setting that will allow the ActiveX object to be created is:

    Tools Menu -> Internet Options -> Security -> Custom level -> "Initialize and script ActiveX controls not marked as safe for scripting"

    This needs to be set to "enabled" for it to work. This is however a huge security issue and therefore if you absolutely must do this I would only recommend that you apply it to the "trusted sites" security zone and list the site you need it to work on as a member of that zone. If you are trying to get this to work on a local dev box then simply enter http://localhost as a trusted site and enable this setting for the trusted sites zone.

  13. #13
    Join Date
    May 2002
    Posts
    10,943

    Re: OLE automation in javascript (automation server cannot create object)

    Welcome to the forums, Syllus. Please remember to make your posts more relevant. This thread is almost 5 years old.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured