Hi,
I'm writing an intranet site allowing users to add/remove network printers to their own machines. I'm using ASP.NET/C# for the pages, and WMI for the printer operations.
All is fine when running on my localhost, but when publishing the site to the server, I get the dreaded Access Denied exception when carrying out the WMI operations.
Firstly, I'd like to make sure what I'm trying to do is actually possible! Can anyone confirm please?
Secondly, if it is possible, can anyone tell me what I need to do to get this working?
Here's what I've got so far:
I'm writing an intranet site allowing users to add/remove network printers to their own machines. I'm using ASP.NET/C# for the pages, and WMI for the printer operations.
All is fine when running on my localhost, but when publishing the site to the server, I get the dreaded Access Denied exception when carrying out the WMI operations.
Firstly, I'd like to make sure what I'm trying to do is actually possible! Can anyone confirm please?
Secondly, if it is possible, can anyone tell me what I need to do to get this working?
Here's what I've got so far:
- Webpage is set to impersonate and the site in IIS has Windows Authentication enabled and Allow Anonymous Access disabled.
- The page does indeed display my username correctly using HttpContext.Current.User.Identity.Name
- In the ConnectionOptions, I'm using ImpersonationLevel.Impersonate and AuthenticationLevel.Default
- I am in the Administrators group on my machine and the server.
- On my machine and the server, under Computer Management > WMI Control > Properties > Security > Root > Security, the Administrators group has "Allow" for everything.