devxlogo

ASP components and WebClasses may not print correctly

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_USERSoftwareMicrosoftWindows NTCurrent VersionDevices      HKEY_CURRENT_USERSoftwareMicrosoftWindows NTCurrent Version _          PrinterPorts      HKEY_CURRENT_USERSoftwareMicrosoftWindows NTCurrent VersionWindows

to the following subkeys, respectively

      HKEY_USERS.DEFAULTSoftwareMicrosoftWindows NTCurrent VersionDevices      HKEY_USERS.DEFAULTSoftwareMicrosoftWindows NTCurrent Version _          PrinterPorts      HKEY_USERS.DEFAULTSoftwareMicrosoftWindows NTCurrent VersionWindows

For additional information about how to perform this operation, see the Knowledge Base article mentioned below.

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist