aspx ページで Windows ユーザー名を取得しようとしています。
私は次のことを試しました:
<% System.Threading.Thread.CurrentPrincipal = new System.Security.Principal.WindowsPrincipal(System.Security.Principal.WindowsIdentity.GetCurrent()) %>
<%= System.Threading.Thread.CurrentPrincipal.Identity.Name %>
しかし、それはIIS APPPOOL/SBalanceを私に与えるだけです - これは Windows ユーザー名ではありません!
ただし、次のサーバー コントロールを追加すると:
<asp:LoginName ID="LoginName1" runat="server" />
これにより、ドメインとユーザー名が正常に事前入力されます。
では、ログイン コントロールを使用せずに、aspx ページでドメイン/ユーザー名を文字列として取得するにはどうすればよいでしょうか。
ありがとう