I'm building an app on our local intranet....
I can pull the network ID through -User.Identity.Name
Once I have this can I use this, or a token, or LDAP, Active Directory....
to find out more information about the user, firstname, lastname, email...
with using their password.... Any sample code or links would be appreciated
Thanks,
Paul
Dominick Baier - 26 Nov 2007 10:11 GMT
this should get you started:
public static void LookupEmail(NTAccount account)
{
using (DirectoryEntry user = LookupUser(account))
{
Console.WriteLine(user.Properties["mail"].Value);
}
}
static DirectoryEntry LookupUser(NTAccount account)
{
SecurityIdentifier sid = (SecurityIdentifier)
account.Translate(typeof(SecurityIdentifier);
string path = string.Format("LDAP://<SID={0}>", sid.Value);
return new DirectoryEntry(path, null, null, SECURE_BINDING);
}
e.g.
LookupEmail(new NTAccount(WindowsIdentity.GetCurrent().Name));
-----
Dominick Baier (http://www.leastprivilege.com)
Developing More Secure Microsoft ASP.NET 2.0 Applications (http://www.microsoft.com/mspress/books/9989.asp)
> I'm building an app on our local intranet....
>
[quoted text clipped - 7 lines]
> Thanks,
> Paul