該站點正在我的本地IIS 6.1上運行。我想添加一些功能來從我們的AD中獲取信息。我的AD代碼適用於許多其他項目和我的開發服務器。下面是我嘗試在寫出來的用戶名:我得到如何獲取當前用戶的windows身份
Response.Write("1. " + this.Request.LogonUserIdentity.Name);
Response.Write("2. " + Request.ServerVariables["Auth_User"]);
Response.Write("3. " + WindowsIdentity.GetCurrent().Name.ToString());
的結果是:
- NT AUTHORITY \ IUSR
- 管理員
- NT AUTHORITY \ NETWORK SERVICE
如何獲取實際的Windows用戶名,例如我們的域名/用戶名
感謝