-1
我想爲我的ASP.NET Intranet應用程序啓用Windows身份驗證。 爲此,我在我的web.config
文件中完成了以下步驟。帶有模擬功能的ASP.NET Windows身份驗證
<system.web>
<authentication mode="Windows" >
</authentication>
<authorization>
<deny users="?"/>
</authorization>
<identity impersonate="true" userName="domain\myusername" password="mypwd" />
</system.web>
而且我想在我的網頁訪問身份驗證的用戶名作爲
HttpContext.Current.User.Identity.Name
它拋出一個「拒絕訪問」錯誤消息。
那麼你必須在你的網頁上獲取模擬名稱嗎? –
不,我在這裏沒有得到任何用戶名,它引發了訪問被拒絕的錯誤。當我刪除授權標記時,我可以訪問我的頁面,但不能獲取模擬的用戶。 – Karthikeyan
嘗試使用'WindowsIdentity.Name'或'WindowsIdentity.GetCurrent()。Name'而不是'HttpContext.Current.User.Identity.Name'。 –