Simple Printing Problem?

Discussion in 'ASP .Net Security' started by Brian, Feb 6, 2007.

  1. Brian

    Brian Guest

    Hi all,

    I have an asp.net 2 application that get an image from SQL reporting
    services and sends it to the printer. It works fine as a console application
    on all computers and as an asp.net application on my windows xp computer.
    However when I run it under IIS on a 2003 server it return the error
    message:

    "Settings to access printer '\\server\printer' are not valid."

    I assume this is a security issue related to printing under IIS but am
    unsure where to look. The application is configured with impersonation and
    windows authentication etc.

    Where can I look? What stops a IIS process from accessing network printers
    under a windows account? How come it works on Windows XP but not Windows
    2003?

    Stack trace below but basically it calls PrintDocument.Print.

    Thanks,
    Brian
     
    Brian, Feb 6, 2007
    #1
    1. Advertising

  2. Brian

    Brian Guest

    The stack trace is below. Why does it think that the thread is running under
    network service when I checked and it is running under the impersonated user
    account? Did the Thread.CurrentPrincipal change somehow?
    Brian

    Request information:

    Request path: /batchprint/Execute.aspx

    User host address: 192.168.1.40

    User: domain\user

    Is authenticated: True

    Authentication Type: Negotiate

    Thread account name: NT AUTHORITY\NETWORK SERVICE


    Thread information:

    Thread ID: 8

    Thread account name: NT AUTHORITY\NETWORK SERVICE

    Is impersonating: False

    Stack trace: 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.Drawing.Printing.StandardPrintController.OnStartPrint(PrintDocument
    document, PrintEventArgs e)

    at System.Drawing.Printing.PrintController.Print(PrintDocument document)

    at System.Drawing.Printing.PrintDocument.Print()

    at BatchPrintUtility.PrintReport.Print()

    at BatchPrintUtility.PrintReport.RenderPrint(String Report, String
    Parameters, Int32 Copies)

    at Execute.PrintReportBatch(Object printer)

    at Execute.Page_Load(Object sender, EventArgs e)
     
    Brian, Feb 6, 2007
    #2
    1. Advertising

  3. Brian

    Brian Guest

    Update on the problem:

    The asp.net application seems to work fine on any computer when accessed
    through http://localhost but when accessed through http://computername the
    "PrintDocument.Print" returns the error message.
    "Settings to access printer '\\server\printer' are not valid"

    What is the difference in security (assuming this is the problem) running
    localhost as compared with accessing it through the server?

    Brian
     
    Brian, Feb 7, 2007
    #3
    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. Jon B
    Replies:
    7
    Views:
    7,555
    =?Utf-8?B?SmFzb25DaG9p?=
    Jan 30, 2006
  2. JustSomeGuy
    Replies:
    13
    Views:
    519
    msalters
    Dec 9, 2004
  3. iffy agbim
    Replies:
    1
    Views:
    114
    Mark Andrews
    May 24, 2004
  4. iffy agbim
    Replies:
    0
    Views:
    113
    iffy agbim
    May 21, 2004
Loading...

Share This Page