Powered by Blogger.

Saturday, February 15, 2014

JavaScript runtime error: Automation server can't create object




In this post we will discuss how we can resolve "JavaScript runtime error: Automation server can't create object" which comes when we try to use ActiveXObject with JavaScript in Asp.Net.

Also you can check out some posts on:

- Lock users who provide bad passwords in Asp.Net

- Get stored procedure source text in sql server 2008

- Jagged arrays in C#.Net

Recently I got this error while trying to use ActiveXObject through JavaScript.

I was trying to call like below:

<script type="text/jscript">
        function GetDongleDetails() {
            var x = new ActiveXObject('AxControls.HelloWorld');
            var count = x.GetText();
        };

</script>

And I was getting the error in the below line:

 var x = new ActiveXObject('AxControls.HelloWorld');

I remembered I have reset my IE setting one day back.

Solution:
We need to enable some security options in IE settings.

Go to Tools -> Internet Options -> Then select Security tab and then Click on Custom Level button.

Here we need to enable the below options:
- Run ActiveX controls and plug-ins
-  Initialize and script ActiveX controls not marked as safe for scripting.


After this the error should not come.



0 comments

Post a Comment