Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > printersettings.installedprinters in asp.net not working for non-domain webserver with network printers on domain

Reply
Thread Tools

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

 
 
Tessa
Guest
Posts: n/a
 
      10-16-2006
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


 
Reply With Quote
 
 
 
 
Tessa
Guest
Posts: n/a
 
      10-16-2006
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:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
 
Bryan Phillips
Guest
Posts: n/a
 
      10-26-2006
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:(E-Mail Removed):

> 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:(E-Mail Removed)...
>
> > 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
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
printersettings.installedprinters in asp.net not working for non-domain webserver with network printers on domain Tessa ASP .Net 2 10-26-2006 02:27 AM
Webserver needs to be domain controller or just joind to domain? =?Utf-8?B?VENEb2xwaGluLg==?= ASP .Net 7 09-22-2005 02:44 PM



Advertisments