1

まさにタイトル通り。asp.net ページ内からの Windows ログオンとドメイン情報が必要です。

私は試した

string userName = System.Security.Principal.WindowsIdentity.GetCurrent().Name; 

ただし、ユーザー名ではなくIISアプリケーションプールを返します

ありがとう

4

2 に答える 2

0

これはVB.netの私のコードです

var strUser = System.Web.HttpContext.Current.User.Identity.Name

そのため、C# は次の行にある必要があります: (テストされていません) string strUser = System.Web.HttpContext.Current.User.Identity.Name;

Web.Config ファイル内

<configuration>
    <system.web>
        <authentication mode="Windows"/>
        <identity impersonate="true" />
    </system.web>
</configuration>
于 2013-11-13T21:37:26.007 に答える