My ASP.NET 4.0 Web App is unable to access Network Printers, while debugging on VS 2010. It can access local printers. Seems like it may be a permissions issue. Since VS2010 Debugging runs on ASP.NET Development Server, it must be running under the account I used to log into Windows, right? Does that user need to be added as an Admin in that printers users? Is there any account that I can impersonate to get this working?
A:
without knowing for sure, you can try to impersonate the Network Service, or of course your own domain account which should always work.
BrokenGlass
2010-09-17 19:58:09
How do you impersonate the Network Service?
Prabhu
2010-09-17 20:32:18
A:
You are correct, debugging through Visual Studio means all of your code runs with the same rights as the user logged in to windows. On the server, you will need to setup impersonation and/or setup your Application Pool to run as a user who has access to print on these printers.
I recommend you setup a dedicated domain account (like domain\yourapp-impers-user) and either set the Application Pool to use that, or setup impersonation in your web.config. Then on the print server, you simply grant that user account the necessary permissions.
Nate Bross
2010-09-17 20:09:36
For impersonation, I just do <identity impersonate="true" userName="something" password="something" /> under System.Web, right? How do I setup my Application Pool to run as a particular user?
Prabhu
2010-09-17 20:14:05
Thats correct for impersonation you may end up with `<identity impersonate="true" userName="domain\username" password="something" />` -- you configure the Application Pool through the IIS MMC. Its under the advanced "properties" of your AppPool.
Nate Bross
2010-09-17 21:50:30