print to network printer using ASP.NET on IIS6 (2003 Server)



Is there any security reason why you cannot print to a network printer from
ASP.NET under IIS6 on Windows 2003 server?

I'm using ASP.NET code to print to a server print queue using
(.NET framework v 1.1)
I can print to a local printer plugged into LPT1 on the web server, but not
to a network printer.

The same printing code to a network printer works in a .NET web app when
hosted on Windows XP pro, or Windows 2000 Server, but NOT on Windows 2003
The same printing code to a network printer also works in a .NET Windows app
on Windows 2003 server, when logged in to Windows as the same user that the
web app is impersonating (DOMAIN\webaccount), so we know this account has
sufficient permission to print to the netowrk printer.

Web app configuration details:
Web.config has <authentication mode="windows"/> <identity
Web Application is running in a virtual directory on the Default Web Site
Virtual directory Security: anonymous access is enabled, & set to use the
specific Windows domain account DOMAIN\webaccount. All the other
authenticated access methods are disabled/unchecked
Application pool: our Web Application is using a specific application pool
that uses DOMAIN\webaccount as its identity.
IIS 6 is not running in IIS 5 isolation mode.

The errror from PrintDocument.Print() is
System.Drawing.Printing.InvalidPrinterException: Tried to access printer
'\\REMOTEMACHINE\PrinterName' with invalid settings.

Full stack trace when call PrintDocument.Print:
System.Drawing.Printing.InvalidPrinterException: Tried to access printer
'\\REMOTEMACHINE\PrinterName' with invalid settings. at
System.Drawing.Printing.PrinterSettings.GetHdevmodeInternal() at
pageSettings) at
System.Drawing.Printing.PrintController.OnStartPrint(PrintDocument document,
PrintEventArgs e) at
ent document, PrintEventArgs e) at
System.Drawing.Printing.PrintController.Print(PrintDocument document) at
System.Drawing.Printing.PrintDocument.Print() at
PrintingGDI.WebForm1.Button1_Click(Object sender, EventArgs e)

What could be preventing ASP.NET from printing to a network printer?

Thanks for any ideas,



Aug 14, 2006
Reaction score
Did you ever figure this out?

I'm having the same problem -- any fixes that you found would be a great help.


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question