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

Discussion in 'ASP .Net' started by Tessa, Jul 27, 2004.

  1. Tessa

    Tessa Guest

    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
    PrintDocument.Print()
    (.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
    server.
    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
    impersonate="true">
    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
    System.Drawing.Printing.PrinterSettings.GetHdevmode(PageSettings
    pageSettings) at
    System.Drawing.Printing.PrintController.OnStartPrint(PrintDocument document,
    PrintEventArgs e) at
    System.Windows.Forms.PrintControllerWithStatusDialog.OnStartPrint(PrintDocum
    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,

    Tessa
     
    Tessa, Jul 27, 2004
    #1
    1. Advertising

  2. Tessa

    jimbo

    Joined:
    Aug 14, 2006
    Messages:
    1
    Did you ever figure this out?

    I'm having the same problem -- any fixes that you found would be a great help.
     
    jimbo, Aug 14, 2006
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tessa
    Replies:
    0
    Views:
    832
    Tessa
    Jul 26, 2004
  2. =?Utf-8?B?cGVuZw==?=

    How to print label on network shared printer in ASP.Net

    =?Utf-8?B?cGVuZw==?=, Mar 9, 2006, in forum: ASP .Net
    Replies:
    67
    Views:
    5,066
    ipldev ipldev
    Aug 4, 2010
  3. jeremy Lee
    Replies:
    2
    Views:
    587
    George Ter-Saakov
    Jan 26, 2007
  4. Mark Villahermosa
    Replies:
    0
    Views:
    383
    Mark Villahermosa
    Jul 31, 2008
  5. Tessa
    Replies:
    1
    Views:
    325
    Guest
    Apr 29, 2005
Loading...

Share This Page