WindowsPrincipal impersonate Help!!!

mesa t

Member
Joined
Jan 15, 2004
Messages
5
Hello;

I have a VB.NET Windows app in which I need to authenticate the user aganist AD. If the user authenticated is not the user logged on to the Domain (one machine multiple users) I want the execution of the app to use the account just authenticated, not the user logged to the domain.

The authentication aganist the AD works fine but how do I take it a step further and switch principals???

Here is some code....

/////////////Challenge aganist AD ///////


Dim _Path As String = "LDAP://XX.XXXXXX.COM"
Dim Entry As DirectoryEntry = New DirectoryEntry(_Path, uname, pass)


Try
////IF Success then user belongs to Domain///////////

Dim _Nat As Object = Entry.NativeObject
Catch ex As Exception
Return ex.Message
End Try

Once I compare Users from AD look up vs WindowsIdentity.GetCurrent() and they do not match, I need to assign Thread execution to the AD look up user....

Any tips or sample code would be tremendously appreciated...

Thanks,
Tino
 
Back
Top