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
即可得到域名及用戶名