Click here to Skip to main content
12,358,510 members (60,444 online)
Rate this:
 
Please Sign up or sign in to vote.
Hi,

<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 13-Aug-12 19:53pm
Updated 4-Oct-12 2:43am
DaveAuld187.1K
v2
Comments
learner'sbug 16-Aug-12 16:48pm
   
Did you check this link..
http://forums.asp.net/t/1226789.aspx/1

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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..
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160621.1 | Last Updated 29 Oct 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100