IIS7,ASP.net 2.0獲取客戶端登陸用戶名

 1. IIS7管理頁面裏面,找到要管理的網站,點擊“Authentication”進入,將Anonymous authentication 設爲disabled, 將windows authentication 設爲enabled,如果沒有windows authentication項,到控制面板安裝ii7頁面裏的安全性項尋找安裝。

此設置即將iis設爲windows集成登陸,不允許匿名windows集成驗證 

 

2. 在asp.net 的web.config文件裏添加“ <identity impersonate="true" />”以將asp設爲模擬 IIS 驗證的帳戶或用戶

 

3. 在asp.net的程序中通過 string name = HttpContext.Current.User.Identity.Name

    即可得到域名及用戶名

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章