Active X control error"Automation server can't create object"http://forums.asp.net/t/1226789.aspx/1?Active+X+control+error+Automation+server+can+t+create+object+Fri, 13 Apr 2012 14:55:15 -040012267892203271http://forums.asp.net/p/1226789/2203271.aspx/1?Active+X+control+error+Automation+server+can+t+create+object+Active X control error"Automation server can't create object" <p>hi friends,</p> <p>My task is to &quot;Write ActiveX Control for fetching MACID of client machine.&quot;</p> <p>I'm new to this active X controls.I created a dll by choosing projects-&gt;class library</p> <p>and created a dll.The code is as follows:</p> <font color="#0000ff" size="2"> <p>using</font><font size="2"> System;</p> </font><font color="#0000ff" size="2"> <p>using</font><font size="2"> System.Runtime.InteropServices;</p> </font><font color="#0000ff" size="2">namespace</font><font size="2"> DimensionsClientsSystemInfo</font><font size="2"> <p>{</p> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">interface</font><font size="2"> </font><font color="#008080" size="2">ASignatures</p> </font><font size="2"> <p>{</p> </font><font color="#0000ff" size="2">string</font><font size="2"> MacID();</font><font size="2"> <p></font><font color="#0000ff" size="2">string</font><font size="2"> ComputerName();</p> </font><font color="#0000ff" size="2">string</font><font size="2"> IPAddress();</font><font size="2"> <p>}</p> [</font><font color="#008080" size="2">ClassInterface</font><font size="2">(</font><font color="#008080" size="2">ClassInterfaceType</font><font size="2">.AutoDual)]</font><font size="2"> <p></font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">class</font><font size="2"> </font><font color="#008080" size="2">AClass</font><font size="2"> : </font><font color="#008080" size="2">ASignatures</p> </font><font size="2"> <p>{</p> </font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">string</font><font size="2"> MacID()</font><font size="2"> <p>{</p> </font><font color="#0000ff" size="2">return</font><font size="2"> </font><font color="#800000" size="2">&quot;xxx0001&quot;</font><font size="2">;</font><font size="2"> <p>}</p> </font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">string</font><font size="2"> ComputerName()</font><font size="2"> <p>{</p> </font><font color="#0000ff" size="2">return</font><font size="2"> </font><font color="#800000" size="2">&quot;DimensionsLiveO&quot;</font><font size="2">;</font><font size="2"> <p>}</p> </font><font color="#0000ff" size="2">public</font><font size="2"> </font><font color="#0000ff" size="2">string</font><font size="2"> IPAddress()</font><font size="2"> <p>{</p> </font><font color="#0000ff" size="2">return</font><font size="2"> </font><font color="#800000" size="2">&quot;124.125.133.74&quot;</font><font size="2">;</font><font size="2"> <p>}</p> <p>}</p> <p>}</p> <p>my next step was to implement this dll in a web application using javascript.</p> <p>For this I tried the following code:</p> <font size="2"> <p>&lt;%</font><font color="#0000ff" size="2">@</font><font size="2"> </font><font color="#800000" size="2">Page</font><font size="2"> </font><font color="#ff0000" size="2">Language</font><font color="#0000ff" size="2">=&quot;C#&quot;</font><font size="2"> </font><font color="#ff0000" size="2">AutoEventWireup</font><font color="#0000ff" size="2">=&quot;true&quot;</font><font size="2"> </font><font color="#ff0000" size="2">CodeFile</font><font color="#0000ff" size="2">=&quot;Default.aspx.cs&quot;</font><font size="2"> </font><font color="#ff0000" size="2">Inherits</font><font color="#0000ff" size="2">=&quot;_Default&quot;</font><font size="2"> %&gt;</p> </font><font color="#0000ff" size="2">&lt;!</font><font color="#800000" size="2">DOCTYPE</font><font size="2"> </font><font color="#ff0000" size="2">html</font><font size="2"> </font><font color="#ff0000" size="2">PUBLIC</font><font size="2"> </font><font color="#0000ff" size="2">&quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot;</font><font size="2"> </font><font color="#0000ff" size="2">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;</font></font><font color="#0000ff" size="2"> <p>&lt;</font><font color="#800000" size="2">html</font><font size="2"> </font><font color="#ff0000" size="2">xmlns</font><font color="#0000ff" size="2">=&quot;http://www.w3.org/1999/xhtml&quot;</font><font size="2"> </font><font color="#0000ff" size="2">&gt;</p> &lt;</font><font color="#800000" size="2">head</font><font size="2"> </font><font color="#ff0000" size="2">runat</font><font color="#0000ff" size="2">=&quot;server&quot;&gt;</font><font color="#0000ff" size="2"> <p>&lt;</font><font color="#800000" size="2">object</font><font size="2"> </font><font color="#ff0000" size="2">id</font><font color="#0000ff" size="2">=&quot;rtfcontrol&quot;</font><font size="2"> </font><font color="#ff0000" size="2">height</font><font color="#0000ff" size="2">=&quot;472&quot;</font><font size="2"> </font><font color="#ff0000" size="2">width</font><font color="#0000ff" size="2">=&quot;488&quot;</p> </font><font size="2"></font><font color="#ff0000" size="2">classid</font><font color="#0000ff" size="2">=&quot;Bin/DimensionsClientsSystemInfo.dll&quot;&gt;</font><font color="#0000ff" size="2"> <p>&lt;/</font><font color="#800000" size="2">object</font><font color="#0000ff" size="2">&gt;</p> <p>&lt;</font><font color="#800000" size="2">title</font><font color="#0000ff" size="2">&gt;</font><font size="2">ActiveX</font><font color="#0000ff" size="2">&lt;/</font><font color="#800000" size="2">title</font><font color="#0000ff" size="2">&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">script</font><font size="2"> </font><font color="#ff0000" size="2">type</font><font color="#0000ff" size="2">=&quot;text/javascript&quot;</font><font size="2"> </font><font color="#ff0000" size="2">language</font><font color="#0000ff" size="2">=&quot;javascript&quot;&gt;</p> </font><font size="2"> <p>&nbsp;</p> <p>&nbsp;</p> </font><font color="#0000ff" size="2">var</font><font size="2"> x = </font><font color="#0000ff" size="2">new</font><font size="2"> ActiveXObject(</font><font color="#800000" size="2">&quot;AClass.dll&quot;</font><font size="2">);</font><font size="2"> <p>&nbsp;</p> <p>alert(x.MacID());</p> </font><font color="#0000ff" size="2">&lt;/</font><font color="#800000" size="2">script</font><font color="#0000ff" size="2">&gt;</font><font color="#0000ff" size="2"> <p>&lt;/</font><font color="#800000" size="2">head</font><font color="#0000ff" size="2">&gt;</p> <p>&lt;</font><font color="#800000" size="2">body</font><font color="#0000ff" size="2">&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">form</font><font size="2"> </font><font color="#ff0000" size="2">id</font><font color="#0000ff" size="2">=&quot;form1&quot;</font><font size="2"> </font><font color="#ff0000" size="2">runat</font><font color="#0000ff" size="2">=&quot;server&quot;&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">div</font><font color="#0000ff" size="2">&gt;</p> </font><font size="2"> <p></font><font color="#0000ff" size="2">&lt;</font><font color="#800000" size="2">asp</font><font color="#0000ff" size="2">:</font><font color="#800000" size="2">Label</font><font size="2"> </font><font color="#ff0000" size="2">ID</font><font color="#0000ff" size="2">=&quot;Label1&quot;</font><font size="2"> </font><font color="#ff0000" size="2">runat</font><font color="#0000ff" size="2">=&quot;server&quot;</font><font size="2"> </font><font color="#ff0000" size="2">Text</font><font color="#0000ff" size="2">=&quot;Label&quot;&gt;&lt;/</font><font color="#800000" size="2">asp</font><font color="#0000ff" size="2">:</font><font color="#800000" size="2">Label</font><font color="#0000ff" size="2">&gt;&lt;/</font><font color="#800000" size="2">div</font><font color="#0000ff" size="2">&gt;</p> </font><font size="2"></font><font color="#0000ff" size="2">&lt;/</font><font color="#800000" size="2">form</font><font color="#0000ff" size="2">&gt;</font><font color="#0000ff" size="2"> <p>&lt;/</font><font color="#800000" size="2">body</font><font color="#0000ff" size="2">&gt;</p> &lt;/</font><font color="#800000" size="2">html</font><font color="#0000ff" size="2">&gt;</font><font color="#0000ff" size="2"> <p></font>but when running javascript error:&quot;Automation Server can't create an object&quot;&nbsp;results.</p> <p>is there any mistake in my code.I think my dll is working but error is in the aspx file.</p> <p>can anyone help me.</p> <p>I used the reference:http://dotnetslackers.com/articles/csharp/WritingAnActiveXControlInCSharp.aspx</p> <p>dim505</p> <p>&nbsp;</p> <p>&nbsp;</p> 2008-02-29T04:51:13-05:002203902http://forums.asp.net/p/1226789/2203902.aspx/1?Re+Active+X+control+error+Automation+server+can+t+create+object+Re: Active X control error"Automation server can't create object" <p>Did you copy the assembly and also the type library for the assembly (created via tlb.exe) on to the target machine? </p> 2008-02-29T11:11:47-05:002208066http://forums.asp.net/p/1226789/2208066.aspx/1?Re+Active+X+control+error+Automation+server+can+t+create+object+Re: Active X control error"Automation server can't create object" <p>yes,but I get the same error</p> <p>I altered the settings of IE.</p> <p>&quot;Tools &gt; Internet options &gt; Security &gt;&nbsp;Custom Level</p> <p>Under the <strong>ActiveX controls and plug-ins</strong>, select <strong>Enable </strong>for <strong>Initializing and Script ActiveX controls not marked as safe</strong>. &quot;</p> <p>executed&nbsp; the command </p> <pre class="dos">csc /t:library Myclass.cs</pre> <pre class="dos">regasm mydll.dll /tlb /codebase</pre> <p><strong>REGSVR32 SHIMGVW.DLL</strong></p> <p>but gets the same error.pls help me??????</p> 2008-03-03T10:23:55-05:002209660http://forums.asp.net/p/1226789/2209660.aspx/1?Re+Active+X+control+error+Automation+server+can+t+create+object+Re: Active X control error"Automation server can't create object" <p>Hi</p> <p>That 's the way I call activex on my box and it works well, </p> <pre class="prettyprint">&lt;html&gt; &lt;head&gt; &lt;script language=&quot;javascript&quot;&gt; &lt;!-- Load the ActiveX object --&gt; var x = new ActiveXObject(&quot;DimensionsClientsSystemInfo.AClass&quot;); &lt;!-- Access the Method --&gt; alert(x.MacID()); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt;</pre>&nbsp;Hope the above information helps 2008-03-04T02:14:00-05:002215888http://forums.asp.net/p/1226789/2215888.aspx/1?Re+Active+X+control+error+Automation+server+can+t+create+object+Re: Active X control error"Automation server can't create object" <p>finally I got the script running.</p> <p>for that executed the commands regasm path/mydll.dll</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; regasm path/mydll.dll/tlb</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gacutil mydll.dll</p> <p>and when executed the web application I got the alert.</p> <p>&lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;<br> &nbsp;&nbsp; &lt;!-- Load the ActiveX object&nbsp; --&gt;<br> &nbsp;&nbsp;&nbsp; var x = new ActiveXObject(&quot;DimensionsClientsSystemInfo.DimensionsClientsSystemInfo&quot;);&nbsp;</p> <p>&nbsp;&nbsp;&nbsp; alert(x.MacID());</p> <p>&nbsp;&nbsp;&nbsp;&nbsp;var XLApp = new ActiveXObject(&quot;Word.Application&quot;);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br> &nbsp;&nbsp; alert(XLApp.Version);<br> &nbsp;&nbsp;&nbsp;&nbsp;<br> &nbsp; &lt;/script&gt;</p> <p>&nbsp;</p> <p>all works fine but when I published the web application and executed it from the server,the same error repeats</p> <p>&quot;Automation server can' create object&quot;</p> <p>should I alter any another settings???</p> <p>pls help.....</p> <p>dim505</p> 2008-03-06T08:47:29-05:002216066http://forums.asp.net/p/1226789/2216066.aspx/1?Re+Active+X+control+error+Automation+server+can+t+create+object+Re: Active X control error"Automation server can't create object" <p>Hi</p> <p>One approch is copy the dll to each client machine and register using regasm.exe, then you will not receive create object error</p> <p>(See quotes from <a href="http://dotnetslackers.com/articles/csharp/WritingAnActiveXControlInCSharp.aspx"> http://dotnetslackers.com/articles/csharp/WritingAnActiveXControlInCSharp.aspx</a></p> <p><font color="#996666"><em>You can register the assembly in multiple ways of implementation and it mostly depends on the target users. For example, creating a setup file for download or having a self extractor file which could prompt in the browser, )</em></font></p> <p>Another way is use COM class factory for component with CLSID ----e.g:&nbsp;{0006FB3A-0000-0000-C100-000001000046}, let the client browser to download the control for install</p> <p>For more information, please view my post in this thread</p> <p><a href="http://forums.asp.net/p/1192196/2059612.aspx#2059612">http://forums.asp.net/p/1192196/2059612.aspx#2059612</a></p> 2008-03-06T10:19:05-05:004855947http://forums.asp.net/p/1226789/4855947.aspx/1?Re+Active+X+control+error+Automation+server+can+t+create+object+Re: Active X control error"Automation server can't create object" <p>Dear All,</p> <p></p> <p>In the above example client is required dotnet framework where as in my context, it is not possible.</p> <p>I want to write a activex control to fetch mac id of client in the web application without dotnet framework requirement at client side.</p> <p></p> <p>With Regards</p> <p>Palanivelrajan</p> 2012-02-29T04:53:21-05:004931410http://forums.asp.net/p/1226789/4931410.aspx/1?Re+Active+X+control+error+Automation+server+can+t+create+object+Re: Active X control error"Automation server can't create object" <p>I had the similar error when creating scripting.filesystem object and got fixed by running &nbsp;<strong>regsvr32 scrrun.dll</strong></p> 2012-04-13T14:55:15-04:00