3
Answers

active directory information

kudeep

kudeep

20y
2.9k
1
Hi Everyone I am facing a problem in getting the name and email id of the user who is currently logged in the intranet application. All the information is stored in Active Directory. What i want is to get the required values from the active directory for the logged user. Anybody if knows what is the code, pls pass it to me. Rgds Deepak
Answers (3)
0
jshepler

jshepler

NA 63 0 20y
Nothing obvious jumps out at me - try it and see what happens. Since you're just returning a value, it won't break AD.
0
kudeep

kudeep

NA 3 0 20y
Thanks a lot. I had tried the following code. AD is not installed on my server. This will be tested on other server. Please verify n tell me if it is going to work. If not what other changes i'll have to make. Since it it not giving any error. DirectoryEntry obDirEntry = null; obDirEntry = new DirectoryEntry("WinNT://" + strDomain + "/" + strName); System.DirectoryServices.PropertyCollection coll = obDirEntry.Properties; object obVal = coll["FullName"].Value; str = obVal.ToString(); return str;
0
jshepler

jshepler

NA 63 0 20y
Use Request.ServerVariables["LOGON_USER"] to get the DOMAIN\USER that is logged in. You'll have to strip off the DOMAIN\ and compare the USER against userPrincipalName property of your users inn AD. Do you know how to work with AD from .NET ? If not, read up on the System.DirectoryServices namespace.
Next Recommended Forum