PrinterSettings.IsValid always returning false
Posted
by Jarrod
on Stack Overflow
See other posts from Stack Overflow
or by Jarrod
Published on 2010-05-21T17:29:27Z
Indexed on
2010/05/21
17:30 UTC
Read the original article
Hit count: 365
In our code, we have to give the users a list of printers to choose from. The user then chooses a printer and it is checked to verify it is valid before printing. On a windows 2003 server with IIS 6, this works fine. On a windows 2008 server with IIS 7, it fails each time impersonate is set to true.
PrinterSettings printerSetting = new PrinterSettings(); printerSetting.PrinterName = ddlPrinterName.SelectedItem.Text; if (!printerSetting.IsValid) { lblMsg.Text = "Server Printer is not valid."; } else { lblMsg.Text = "Success"; }
Each time this code is run, the "Server Printer is not valid" displays, only if impersonate is set to true. If impersonate is set to false, the success message is displayed.
The impersonation user has full rights to the printer.
Is there a way to catch the actual reason the printer is not valid? Is there some other 2008 setting I should check?
© Stack Overflow or respective owner