Re: Impersonate via a remote workgroup

Hi Dominick,

Glad you replied.

I've tried that. It doesn't seem to impersonate. However, I also seem to have access to resources on the remote domain.
It sounds a bit weird, and I'm not sure what happens.

This is (in short) what I do:

if (Api.LogonUser(sUserName, sDomain, sPassword,
Api.LogonProvider.Default, out token))
if (Api.DuplicateToken(token, Api.TOKEN_DUPLICATE,
out tokenDuplicate))
tmpWindowsIdentity = new WindowsIdentity(tokenDuplicate);
_impersonationContext = tmpWindowsIdentity.Impersonate();
if (_impersonationContext != null)
return true;

(I don't need the duplication, I know).

When I try this with the Interactive logon session type, it fails all together. I am able to access the remote resources!

strangely enough, when I call
after the impersonation, it still denotes my original user.
Whereas when I impersonate on of my local or own domain accounts (using Interactive) it states the impersonated user.

Is there an explanation on this?



Posted using Newsgroups -