Sas*_*ach 7 .net c# asp.net authentication iis
我试图从ASP.Net应用程序的调用者那里获得当前的WindowsIdentity而不进行模拟.
阅读一些文章后我的设置是:
出于测试目的,我编写了以下日志语句
m_techLogger.Warn(string.Format("Request[LOGON_USER] {0}", Request["LOGON_USER"]));
m_techLogger.Warn(string.Format("Request.LogonUserIdentity {0}", Request.LogonUserIdentity.Name));
m_techLogger.Warn(string.Format("HttpContext.Current.User.Identity {0}", HttpContext.Current.User.Identity.Name));
m_techLogger.Warn(string.Format("WindowsIdentity.GetCurrent() {0}", WindowsIdentity.GetCurrent().Name));
这些陈述返回以下内容
2015-04-23 10:47:19,628 [7] WARN  - Request[LOGON_USER] DOMAIN\User
2015-04-23 10:47:19,681 [7] WARN  - Request.LogonUserIdentity NT AUTHORITY\SYSTEM
2015-04-23 10:47:19,681 [7] WARN  - HttpContext.Current.User.Identity NT AUTHORITY\SYSTEM
2015-04-23 10:47:19,681 [7] WARN  - WindowsIdentity.GetCurrent() NT AUTHORITY\SYSTEM
我了解WindowsIdentity.GetCurrent().Name返回系统用户.我不明白为什么Request.LogonUserIdentity和Request [LOGON_USER]的输出不同.我需要来自User的WindowsIdentity对象,其名称由Request [LOGON_USER]返回.
任何人都能指出我正确的方向吗?
当我尝试同样的事情时我得到
    Request.LogonUserIdentity.Name  "DOMAIN\\accountname"   (no capital letter)
    Request["LOGON_USER"]   "DOMAIN\\Accountname"   (capital letters)
为了获取我们的 ASP.NET 应用程序中的当前用户,我使用了这行代码
User.Identity.Name
这有什么帮助吗?
| 归档时间: | 
 | 
| 查看次数: | 3282 次 | 
| 最近记录: |