Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / October 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Tessa - 16 Oct 2006 07:02 GMT
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 - 17 Oct 2006 00:54 GMT
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?

> Hi,
>
[quoted text clipped - 20 lines]
> regards,
> Tessa
Bryan Phillips - 26 Oct 2006 03:27 GMT
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

> 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
[quoted text clipped - 30 lines]
> > regards,
> > Tessa

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.