473,320 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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
Oct 16 '06 #1
2 6193
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" <nospamwrote in message
news:eG*************@TK2MSFTNGP05.phx.gbl...
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

Oct 16 '06 #2
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" <nospamwrote in message
news:ek*************@TK2MSFTNGP03.phx.gbl:
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" <nospamwrote in message
news:eG*************@TK2MSFTNGP05.phx.gbl...
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
Oct 26 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: BJS | last post by:
Sorry for the cross-posting, but based on the number of people I have seen ask for a solution to this problem, I hope by cross-posting this, that it will help a lot of people out of a common...
3
by: RBisch | last post by:
I am finding that some of the properties off of the PrinterSettings object are misleading For example, When I test the CanDuplex on a printer I know duplexes, the property is false. Another one...
3
by: Steve Hanna | last post by:
I am having problems using the Printer Dialog to set PrinterSettings, specifically the landscape property of the DefaultPageSettings. Here's the code: <code> Private Sub GetPrinter(ByRef...
3
by: Jochen Kalmbach | last post by:
Hello, if an PrinterSettings-Instance is not set-up correctly (for example just by using the default-constructor), then the "ToString()"_method will throw an exception! Unhandled...
2
by: Robert Hooker | last post by:
Hi, I'm curious to know if I'm doing something wrong here, or if this is just mind-numbingly slow for a reason. In a simple WindowsFormsApplication: public Form1() { // Required for...
0
by: trint | last post by:
try { // Wait for the report to completely render. if(m_numberOfPages < 1) return false; PrinterSettings printerSettings = new PrinterSettings(); printerSettings.MaximumPage = m_numberOfPages;...
3
by: trint | last post by:
Can someone help me to get this code to work...I'm unsure what the 'printDoc' variable is supposed to be? // Add list of paper sources found on the printer to the combo box. // The DisplayMember...
0
by: Just Me | last post by:
I know that if mPD is a PrintDocument then these two are not equal mPD.DefaultPageSettings mPD.PrinterSettings.DefaultPageSettings But I need a quick description when each is used. Also:...
0
by: Craig Scheets | last post by:
I'm familiar with the shortcoming of 1.0/1.1 where the PrinterSettings class cannot be serialized. Is this fixed in Framework 2.0? I may upgrade the project I'm working on if that's the case, I...
2
by: =?Utf-8?B?RGF2aWQ=?= | last post by:
I’m not sure how to feed PCL commands (i.e. “Ec&l1S”) thru the PrinterSettings() function, but we have been successfully using the PrinterSetting() properties and methods to successfully call...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.