Re: Impersonate via a remote workgroup
- From: Dominick Baier [DevelopMentor] <dbaier@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 5 Jul 2006 18:14:32 +0000 (UTC)
sorry. this only works if you are trying to access remote resources that "know" the account you are impersonating.
---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com
i am trying to impersanate a remote user on a workgroup(NOT Domain)
account. This does not seem to work. Only works for domain or local
user. Anyone have any ideas.
Thanks
Dim tempWindowsIdentity As WindowsIdentity
Dim token As IntPtr = IntPtr.Zero
Dim tokenDuplicate As IntPtr = IntPtr.Zero
impersonateValidUser = False
If RevertToSelf() Then
If LogonUserA(userName, domain, password,
LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, token) <> 0 Then
If DuplicateToken(token, 2, tokenDuplicate) <> 0 Then
tempWindowsIdentity = New
WindowsIdentity(tokenDuplicate)
impersonationContext =
tempWindowsIdentity.Impersonate()
If Not impersonationContext Is Nothing Then
impersonateValidUser = True
End If
End If
End If
End If
If Not tokenDuplicate.Equals(IntPtr.Zero) Then
CloseHandle(tokenDuplicate)
End If
If Not token.Equals(IntPtr.Zero) Then
CloseHandle(token)
End If
.
- Prev by Date: Re: Impersonate via a remote workgroup
- Next by Date: Re: ASPdotNet Deployment
- Previous by thread: Re: Impersonate via a remote workgroup
- Index(es):
Relevant Pages
|
|