Revision: 4913
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 28, 2008 17:04 by rengber
Initial Code
private string GetUserName() { string retVal = string.Empty; //Pull the username out of the domain\user string. retVal = Page.User.Identity.Name.Split('\\')[1]; DirectoryEntry userEntry = new DirectoryEntry("WinNT://" + userName +",User"); retVal = (string)userEntry.Properties["fullname"].Value; return retVal; }
Initial URL
Initial Description
Typically won't work if the ASP.Net service identity (in the machine.config ProcessModel section) is a local account.
Initial Title
ASP.Net Code to Get an Active Directory User Name from the Integrated Authentication Principal Name
Initial Tags
security, aspnet
Initial Language
C#