Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Security / November 2007

Tip: Looking for answers? Try searching our database.

user.identity.name

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Paul Duncan - 16 Nov 2007 18:04 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.