Używam metody UserPrincipal.Current.ToString()
w domenie, aby pobrać bieżące logowanie użytkownika domeny z prawidłową domeną. ale kiedy jestem Wyświetlanie go w ciąg jego dające błąd podczas hostowane na serwerze IIS:Nie można rzutować obiektu typu w System.DirectoryServices.AccountManagement.GroupPrincipal
Unable to cast object of type 'System.DirectoryServices.AccountManagement.GroupPrincipal'
to type 'System.DirectoryServices.AccountManagement.UserPrincipal'.
Czy to pomaga? http://stackoverflow.com/a/10848934/43846 – stuartd