I am Using Method UserPrincipal.Current.ToString()
in Domain to Get Current Logged in Domain User with Valid Domain. but when i am Displaying it in a string its giv
I had the same problem. It worked perfectly on my local machine but when deployed it to IIS on the server it failed. In the end I had to change two things to make it work:
Change the Authentication to "Windows Authentication" (how-to)
Instead of using current, doing it in two steps: (source)
PrincipalContext ctx = new PrincipalContext(ContextType.Domain);
UserPrincipal user = UserPrincipal.FindByIdentity(ctx, User.Identity.Name);
And to finally get the name (or any other info), I used user.DisplayName
.