Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActiveXObject creation error " Automation server can't create object"

I have a very simple javascript code,

<script language="javascript">          
         function RunExe()   
         {  
           w = new ActiveXObject("WScript.Shell");
           w.run('notepad.exe');
           return true;

         }  
</script>
    <form id="form1">
    <div>
      <input type="button" value="Run" onclick="return RunExe()" />
    </div>
    </form>

Which create an activeX object to run notepad.exe, if I save this in a plain html and run it in the IE, it works fine opening up the notepad, but if I insert this into a aspx page and run it, it will give an error called "Automation server can't create object", I googled it many times, but the IE security things I have already done and I think it's something in ASP or IIS which I couldn't figure out.

Your suggestions and inputs are highly appreciable.

Thanx

like image 201
Asanka Avatar asked Nov 11 '10 11:11

Asanka


People also ask

How to Fix Automation Server can t Create Object Error?

You might encounter the problem that automation server can't create object on Windows 10 because your browser's Internet security settings are too strict, especially after installing an add-on. To solve the problem, you need to change security settings, and then clear the browsing history.

What is ActiveX component can't create object?

This behavior can occur if any of the following conditions are true: Data Access Objects (DAO) is not properly registered. One or more references are missing. There is a utility database reference that is not valid.

What is ActiveX automation?

ActiveX Automation, formerly known as OLE (Object Linking and Embedding) Automation, allows you to manipulate programmable objects from internal environments such as Visual Basic for Applications (VBA) or external environments such as Microsoft® Visual Basic and other applications that incorporate VBA.


2 Answers

This is caused by Security settings for internet explorer. You can fix this,by changing internet explorer settings.Go To Settings->Internet Options->Security Tabs. You will see different zones:i)Internet ii)Local Intranet iii)Trusted Sites iv)Restricted Sites. Depending on your requirement select one zone. I am running my application in localhost so i selected Local intranet and then click Custom Level button. It opens security settings window. Please enable Initialize and script Activex controls not marked as safe for scripting option.It should work.

enter image description here

enter image description here

like image 184
Chandra Malla Avatar answered Sep 25 '22 07:09

Chandra Malla


For this to work you have to really, really loosen your security settings (generally NOT recommended)

You will need to add the website to your "Trusted Zone", then go into the custom settings (scroll about 1/2 way down the page) and change:

ActiveX controls and plugins - Enable (or prompt)... any of the settings that apply to your code (I think the very last one is the one you are hitting) -- "script ActiveX controls marked safe for scripting*"

That all said, unless you have a really, really good reason for doing this - you are opening up a major "hole" in your browsers security... step very carefully... and do not expect that other end users will be willing to do the same.

like image 39
scunliffe Avatar answered Sep 21 '22 07:09

scunliffe