[Asp.net] Windows驗證的網站(包含IIS取消匿名驗證改Windows驗證)

  • Web.config中將<authentication mode ="Windows"></authentication>
  • 程式碼中利用下列代碼抓出使用者名稱
1 HttpContext.Current.User.Identity.Name.Substring(HttpContext.Current.User.Identity.Name.IndexOf('\\') + 1)
  • 做你想要做的事情~

--------------------------------

程式碼原理待探討,還有怎麼抓Domain也要研究一下。

http://technet.microsoft.com/zh-tw/library/cc770966(v=ws.10).aspx

 

posted @ 2013-01-10 11:34  阿練醬  阅读(208)  评论(0编辑  收藏  举报