By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,136 Members | 1,054 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,136 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.GetHdevmod eInternal() at
System.Drawing.Printing.PrinterSettings.GetHdevmod e(PageSettings
pageSettings) at
System.Drawing.Printing.PrintController.OnStartPri nt(PrintDocument document,
PrintEventArgs e) at
System.Windows.Forms.PrintControllerWithStatusDial og.OnStartPrint(PrintDocum
ent document, PrintEventArgs e) at
System.Drawing.Printing.PrintController.Print(Prin tDocument 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,

Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.