Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: VB5,VB6,IIS4,IIS5
Expertise: Intermediate
Jan 1, 2003

ASP components and WebClasses may not print correctly

Printing is one of the things that you can't do directly from withing ASP: to have a printout of your data from ASP you must instantiate a COM component - either a custom component, a WebClass, or a commercial COM server such as Microsoft Word or Excel - and print from there. However, even if printing works when you test your component inside the VB IDE, it fails when you compile the component and deploy it to the production application. The exact error message may vary, but a common one is "ClassName error '800a01e2' Printer error."

The reason is that the COM component runs under the SYSTEM user identity when it's instantiated from within IIS, and by default no printer is installed for this user identity. There are two ways to fix this problem.

The first solution requires that you use DCOMCNFG or another system utility to have the component run under another identity, and of course you select a user that can access the printer you want to send output to.

The second solution is to install the required printers under the SYSTEM user identity. This solution is more complicated, because you can't do that with an interactive tool and must directly modify the Registry, a risky operation. In short, you must copy the contents of these three keys :


      HKEY_CURRENT_USER\Software\Microsoft\Windows NT\Current Version\Devices
      HKEY_CURRENT_USER\Software\Microsoft\Windows NT\Current Version\ _
          PrinterPorts
      HKEY_CURRENT_USER\Software\Microsoft\Windows NT\Current Version\Windows
to the following subkeys, respectively

      HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\Current Version\Devices
      HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\Current Version\ _
          PrinterPorts
      HKEY_USERS\.DEFAULT\Software\Microsoft\Windows NT\Current Version\Windows
For additional information about how to perform this operation, see the Knowledge Base article mentioned below.
Francesco Balena
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap