Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PrinterSettings.InstalledPrinters NOT getting network printers

Tags:

c#

asp.net

wcf

net 2.0

 System.Drawing.Printing.PrinterSettings.InstalledPrinters

as a service to get list of network printers but it can only get local printers. i have googled online found some articles on suggesting configure permission with aspnet_wp

I'm just wondering how to do that

like image 251
Kiddo Avatar asked Oct 20 '25 04:10

Kiddo


1 Answers

You can try as below

1. Changing the account that ASP.NET runs under.

The IIS Worker Process runs as Network Service and the ASP.NET Worker Process runs as ASPNET by default. So to access the Installed Printers you have to change it to run under Local System Account.

2. You can impersonate the asp.net site

When the IIS Worker Process or the ASP.NET Worker Process starts a Web application, the Web application inherits the identity of the process if impersonation is disabled. (Impersonation is the process of allowing a thread to run under a different account from its process.) However, if impersonation is enabled, each Web application runs under the user account that is authenticated by IIS or the user account that is configured in the Web.config file. Impersonation can be enabled in either of the following two ways in Web.config:

<identity impersonate="true"/>

This allows the Web application to run using the identity that was authenticated by IIS.

<identity impersonate="true" userName="SomeUserAccount" password="SomePassword"/>

This allows the Web application to run using a specific identity.

If you have the network printer in my printers then it will show up in Installed printers.

Reference link

like image 74
Harsh Baid Avatar answered Oct 22 '25 17:10

Harsh Baid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!