ドメインのメソッドを使用UserPrincipal.Current.ToString()
して、有効なドメインを持つ現在ログインしているドメインユーザーを取得しています。しかし、文字列で表示している場合、IISサーバーでホストされているとエラーが発生します。
Unable to cast object of type 'System.DirectoryServices.AccountManagement.GroupPrincipal'
to type 'System.DirectoryServices.AccountManagement.UserPrincipal'.