Re: Impersonate via a remote workgroup
- From: melle <melle@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 04 Aug 2006 14:24:35 -0700
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:
Api.RevertToSelf();
if (Api.LogonUser(sUserName, sDomain, sPassword,
Api.LogonType.NewCredentials,
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
System.Security.Principal.WindowsIdentity.GetCurrent().Name
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?
Regards,
Melle
---
Posted using Wimdows.net Newsgroups - http://www.wimdows.net/newsgroups/
.
- Follow-Ups:
- Re: Impersonate via a remote workgroup
- From: Dominick Baier
- Re: Impersonate via a remote workgroup
- References:
- Re: Impersonate via a remote workgroup
- From: melle
- Re: Impersonate via a remote workgroup
- From: Dominick Baier
- Re: Impersonate via a remote workgroup
- Prev by Date: Re: DirectoryService and get all groups
- Next by Date: Newbie: How to ensure only domain admin could use an ASP.NET web page
- Previous by thread: Re: Impersonate via a remote workgroup
- Next by thread: Re: Impersonate via a remote workgroup
- Index(es):