printersettings.installedprinters in asp.net not working for non-domain webserver with network print

Discussion in 'ASP .Net' started by Tessa, Oct 16, 2006.

  1. Tessa

    Tessa Guest

    Hi,

    We have a .net web application, and are trying to use
    PrinterSettings.InstalledPrinters to list the printers installed on the
    webserver. (Windows 2003 server R2, IIS 6, .net framework 2.0.)
    The printers installed on the web server under the account used by asp.net
    for this web application are network printers that are shared by other
    computers that are on our domain. Permission has been granted for everyone
    to print to them.
    The web server running asp.net is not part of the domain, and the account
    used by asp.net is a non-domain account. (It's the identity of the
    application pool WEBSERVER\webappaccount).
    From asp.net we can use PrintDocument.PrinterSettings.PrinterName to set the
    printer name and then PrintDocument.Print works fine to these network
    printers, however, when you use PrinterSettings.InstalledPrinters it
    returns an empty collection, with no exception raised.

    What could be preventing PrinterSettings.InstalledPrinters from being
    populated, given that we can actually print from asp.net?

    any help much appreciated

    regards,
    Tessa
     
    Tessa, Oct 16, 2006
    #1
    1. Advertising

  2. Tessa

    Tessa Guest

    It looks like the same thing happens even if our web application is running
    on a web server which IS in the domain as long as the asp.net identity being
    used is a non-domain account.
    If we use a webserver in the domain & a domain account for asp.net, then it
    does find the network printers - this isn't an option for us in a live
    environment for our clients, unfortunately.

    How can a non-domain account print successfully to a printer shared by a
    computer on a domain, but not find it in PrinterSettings.InstalledPrinters?

    "Tessa" <nospam> wrote in message
    news:...
    > Hi,
    >
    > We have a .net web application, and are trying to use
    > PrinterSettings.InstalledPrinters to list the printers installed on the
    > webserver. (Windows 2003 server R2, IIS 6, .net framework 2.0.)
    > The printers installed on the web server under the account used by asp.net
    > for this web application are network printers that are shared by other
    > computers that are on our domain. Permission has been granted for everyone
    > to print to them.
    > The web server running asp.net is not part of the domain, and the account
    > used by asp.net is a non-domain account. (It's the identity of the
    > application pool WEBSERVER\webappaccount).
    > From asp.net we can use PrintDocument.PrinterSettings.PrinterName to set
    > the printer name and then PrintDocument.Print works fine to these network
    > printers, however, when you use PrinterSettings.InstalledPrinters it
    > returns an empty collection, with no exception raised.
    >
    > What could be preventing PrinterSettings.InstalledPrinters from being
    > populated, given that we can actually print from asp.net?
    >
    > any help much appreciated
    >
    > regards,
    > Tessa
    >
     
    Tessa, Oct 17, 2006
    #2
    1. Advertising

  3. You will have to write code to impersonate a domain user that has
    permissions to print to the network printers and revert to the ASP.Net
    identity afterwards. I print to network printers without referencing
    the InstalledPrinters property. On another note, we careful about
    accessing that property from a non-interactive process since it needs
    access to the user's profile. Those types of activities can cause your
    code to hang.

    Bryan Phillips
    MCSD, MCDBA, MCSE
    Blog: http://bphillips76.spaces.live.com




    "Tessa" <nospam> wrote in message
    news::

    > It looks like the same thing happens even if our web application is running
    > on a web server which IS in the domain as long as the asp.net identity being
    > used is a non-domain account.
    > If we use a webserver in the domain & a domain account for asp.net, then it
    > does find the network printers - this isn't an option for us in a live
    > environment for our clients, unfortunately.
    >
    > How can a non-domain account print successfully to a printer shared by a
    > computer on a domain, but not find it in PrinterSettings.InstalledPrinters?
    >
    > "Tessa" <nospam> wrote in message
    > news:...
    >
    > > Hi,
    > >
    > > We have a .net web application, and are trying to use
    > > PrinterSettings.InstalledPrinters to list the printers installed on the
    > > webserver. (Windows 2003 server R2, IIS 6, .net framework 2.0.)
    > > The printers installed on the web server under the account used by asp.net
    > > for this web application are network printers that are shared by other
    > > computers that are on our domain. Permission has been granted for everyone
    > > to print to them.
    > > The web server running asp.net is not part of the domain, and the account
    > > used by asp.net is a non-domain account. (It's the identity of the
    > > application pool WEBSERVER\webappaccount).
    > > From asp.net we can use PrintDocument.PrinterSettings.PrinterName to set
    > > the printer name and then PrintDocument.Print works fine to these network
    > > printers, however, when you use PrinterSettings.InstalledPrinters it
    > > returns an empty collection, with no exception raised.
    > >
    > > What could be preventing PrinterSettings.InstalledPrinters from being
    > > populated, given that we can actually print from asp.net?
    > >
    > > any help much appreciated
    > >
    > > regards,
    > > Tessa
    > >
     
    Bryan Phillips, Oct 26, 2006
    #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. =?Utf-8?B?TWFydGluIE1vc2Vy?=

    no InstalledPrinters

    =?Utf-8?B?TWFydGluIE1vc2Vy?=, Aug 24, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    411
    =?Utf-8?B?TWFydGluIE1vc2Vy?=
    Aug 24, 2005
  2. =?Utf-8?B?VENEb2xwaGluLg==?=

    Webserver needs to be domain controller or just joind to domain?

    =?Utf-8?B?VENEb2xwaGluLg==?=, Sep 22, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    479
    =?Utf-8?B?VENEb2xwaGluLg==?=
    Sep 22, 2005
  3. =?Utf-8?B?TWlrZQ==?=

    Mixing Non-ASP.NET & ASP.NET Files in One Domain

    =?Utf-8?B?TWlrZQ==?=, Aug 10, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    298
    Cowboy \(Gregory A. Beamer\)
    Aug 10, 2007
  4. lf
    Replies:
    1
    Views:
    122
    Dominick Baier [DevelopMentor]
    Jun 9, 2006
  5. Tessa
    Replies:
    2
    Views:
    292
    Bryan Phillips
    Oct 26, 2006
Loading...

Share This Page