Re: Impersonate via a remote workgroup



Hi Dominick,

I've found multiple posts on google from you, that state that we should
use
NEW_CREDENTIAL in order to log on cross domain... I tried it, and
LogonUser does not fail... that is true, but when I do
ImpersonateLoggedOnUser it doesn't seem to impersonate at all.


Can you tell us what the next step should be?


I am trying to impersonate a user from another domain, that is a domain

my computer is not a part of. All the credentials are ok. that is not a

problem. It just doesn't accept them. (error 1326)


Please advise,


Melle



Dominick wrote:
try to use the NEW_CREDENTIAL logon type.

---------------------------------------
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

.



Relevant Pages

  • Re: LDAP lookup: fails on remote computers -- Please help
    ... > the query from a client however the query fails to run. ... > 'Impersonate the Windows AD user running the application ... > Dim impersonationContext As ... > An unhandled exception was generated during the execution of the ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Permission denied problem. please help me
    ... You want delegation which will allow off-host access as the user who has authenticated in the browser. ... I am using below link page code to impersonate. ... Dim spath As String ...
    (microsoft.public.dotnet.framework.aspnet)
  • Issues with .IsInRole in an Impersonated WindowsPrinciple
    ... I have written code using LogonUser ... impersonate a User Account in the Domain. ... Dim retVal As Boolean = DuplicateToken(tokenHandle, SecurityImpersonation, ... Dim impersonatedUser As WindowsImpersonationContext = newId.Impersonate ...
    (microsoft.public.dotnet.security)
  • Re: Impersonate via a remote workgroup
    ... ImpersonateLoggedOnUser it doesn't seem to impersonate at all. ... Dim tempWindowsIdentity As WindowsIdentity ... Dim tokenDuplicate As IntPtr = IntPtr.Zero ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: impersonate user in windows forms
    ... > The following example demonstrates how to impersonate a user and then ... > Public Shared Function LogonUser(lpszUsername As String, ... > 'The Windows NT user token. ... > Dim token1 As Integer ...
    (microsoft.public.dotnet.languages.vb)

Quantcast