VB .NET and WMI impersonation

G

Guest

Hi anyone.

Does anyone know of issues regarding impersonation in VB .NET with regards
to accessing remote WMI information?

I have a wrapper class which encapsulates various WMI calls, this appeared
fine under .net 1.1, but since sp1 it appears to not work. I have switched
on the debug level to 2 (for WMI) on the machines i am querying, and they are
showing access denied due to the ASPNET user of the local machine making the
query. The web server has been set to require authentication, i have set
impersonation=true in the web.config, and then i am using the following code
(from MSDN i think) to impersonate the logged on user to run the WMI queries:

Dim impersonationContext As
System.Security.Principal.WindowsImpersonationContext
Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity

currentWindowsIdentity = CType(User.Identity,
System.Security.Principal.WindowsIdentity)
impersonationContext = currentWindowsIdentity.Impersonate()

anyone having anything like this? i am hitting a dead end......

cheers
 
W

Willy Denoyette [MVP]

1. Why impersonating in code while you have impersonate=true in your
web.config file?
2. ASPNET can never be used to access remote resources, its a local account
which is unknown at the server.
3. Impersonating a base clients (the autheticated browser client) cannot be
used either unless you have configured everything correctly for kerberos
authentication (which i doubt).

I guess something else has changed in the config.file or at the server.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top