Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jul 28, 2011 11:17 PM by JonesEJ20
Feb 11, 2008 04:43 AM|LINK
Just trying out the new System.DirectoryServices.AccountManagement with Visual Studio 2008 Express Edition.
-Client Windows XP joined to domain
-One Windows Server 2003 domain controller / IIS
I want to get the full name of the logged in user. This works if I specify the domain controller name. Specifying the domain name (either fully qualified or NETBIOS) does not work. Any suggestions ? Am I doing something wrong here.
My working code is like this:
Dim domainContext As New System.DirectoryServices.AccountManagement.PrincipalContect(DirectoryServices.AccountManagement.ContextType.Domain,"testiisdc01")
Response.Write ("Welcome " & System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity(domainContext, User.Identity.Name).DisplayName)
The output is something like:
Welcome Bob Smith.
However if I replace the DC server name testiisdc01 with domain name i.e. testdomain.priv or testdomain, or "testdomain","DC=testdomain,DC=priv"
I get the PrincipalServerDownException error .
I want this code to just use the domain that the current user is logged in under. Any idea how to get this to work?
Jul 28, 2011 11:17 PM|LINK
I was wondering if you were ever able to identify a solution to this issue. I am currently experiencing the same. Thank you for any assistance you can provide.