Click here to Skip to main content
15,880,469 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
Hi,

JavaScript
<script language="javascript">
   function PrintLabel() 
   {
       var ccc = 0;
       var zp = new ActiveXObject('ZebraPrint.ZebraPrintCtl');
       zp.TcpConnection('66.55.1.2', '6101');
       var i = zp.Print('<?xml version="1.0"?>Test Text</xml>');
       alert(i);
   }
</script>
<body>
<form id="form1">
<div>
  <asp:Button ID="btnPrint" runat="server" Text="Print" OnClientClick="javascript:PrintLabel();return false;" />
</div>
</form>
</body>




Running this script on IE 7 which is giving an error called "Automation server can't create object". I tried doing this by changing security levels to a custom level when running on a web server.

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

But still its giving the same error.
Your suggestions and inputs are highly appreciable.

Thanks
Posted
Updated 4-Oct-12 2:43am
v2
Comments
[no name] 16-Aug-12 16:48pm    
Did you check this link..
http://forums.asp.net/t/1226789.aspx/1

1 solution

I have Excel and Word set to Run as Administrator. I do this so I can save files anywhere that I like - not impressed with the efforts to stop me saving into the 'Program Files' or 'Program Files (x86)' folders.

The consequence of this is that if I try to create an ActiveX object for either Word or Excel, it fails.... Unless the program that's trying to create those objects is also run as Admin. I set the webserver to run as a service a long time ago and forgot about the problem. It took me about a day recently to re-discover that little gotcha. I don't recall what the error message was, but I'm 99.98% sure it didn't include anything that mentioned security or permission issues.


To get around this issues when testing stuff designed for IE, I have to start IE as Admin. Which is rather irritating since it's a 'special' shortcut in the start menu, right-clicking to see the shortcut's properties so I can set it to "Always run as Admin" just brings up the Internet Options dialog. So, it's either right-click, Run as Admin every blinking time, or it's create a new shortcut. I chose the former..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900