ADSI user binding(c#)

  • Thread starter Thread starter Jez
  • Start date Start date
J

Jez

Hi-

I am trying to port some code from asp to aspx(c#) that I use to get the
LDAP path of the logged on user so that I can bind to that user in the
active directory and get various properties.

The code I used is as follows:
........
Dim ADSysinfo,UserInfoString,strLDAP,oUser,grps,iGroups

Set ADSysinfo = CreateObject("ADSystemInfo")

UserInfoString = ADSysinfo.Username

strLDAP = "LDAP://DC1/" & UserInfoString

set oUser = GetObject(strLDAP)

......

I know I can bind to a user object using system.directoryservices in .net
and something like

oUser = new DirectoryEntry(strUserADsPath);

but how do I retrieve the strUserAdsPath of the currently logged on user
like I used to with the ADSystemInfo object?

Thanks in advance

Jez
 
Back
Top