Ask a Question related to ASP.NET Security, Design and Development.
-
Todd Thompson #1
Re: Match an Identity to an Active Directory Record.
Here is some code snipped (so it probably won't be compilable per se) from a
web app I developed. In this I query the AD for the users guid.
// snipped code below
protected WindowsIdentity identity = WindowsIdentity.GetCurrent();
protected WindowsPrincipal principal = null;
protected string username = null;
protected string userguid = null;
principal = new WindowsPrincipal(identity);
DirectoryEntry adUserNt = new
DirectoryEntry(("WinNT://"+identity.Name.Replace("\\","/")));
username = adUserNt.Properties["FullName"].Value.ToString();
string sid = "";
System.Array aSid;
aSid = ((System.Array)adUserNt.Properties["objectSID"][0]);
for(int i=0; i<aSid.Length; ++i)
{
sid += ((byte)aSid.GetValue(i)).ToString("X2");
}
DirectoryEntry adUser = new
DirectoryEntry("LDAP://oneOfOurDCs/<sid="+sid+">");
userguid = adUser.Guid.ToString();
// end of snipped code
With the users sid or guid you should be able to do queries using the
DirectorySearcher class for the info you want, if it isn't available in the
DirectoryEntry built using the LDAP query.
HTH,
Todd Thompson
Todd Thompson Guest
-
retrieving last record inserted using @@IDENTITY - ASPJScript
Im triyng to retrieve the last record inserted usnig the "Insert" Server Behavior, in a table that have an auto-incrementig id column. Im trying... -
Identity from inserted record
I'm inserting a record into a SQL Server database. Once the record has been added, I need the Identity value that SQL Server created. Normally, the... -
Active Directory Search fails ("The directory service is unavailab
Hi all, I'm having one of those nerve wrecking errors, when trying to perform a simple search in an Active Directory. The objective of the code... -
Only add one record in subform if criteria match
I have a form named, lets say "a" And a subform in it named "b" form a is assigned to table "c" form b is assigned to table "d" Table "c"... -
Check for Text match in related record
HI, I have a master file with a series of records from a related file displayed in a portal. I need to check if a particular field in any one of...



Reply With Quote

