Lie*_*oen 11 asp.net iis windows-authentication
在HttpContext.Current.User.Principal和WindowsIdentity.GetCurrent()之间打开Windows身份验证和身份模拟的asp.NET环境有什么区别?
Kyl*_*Mit 14
根据这个论坛WindowsIdentity.GetCurrent().Name对User.Identity.Name:
User.Identity.Name表示从IIS传递的标识.WindowsIdentity.GetCurrent().Name是线程运行的标识.
根据您在IIS中的应用程序身份验证设置,它们将返回不同的值:
| Anonymous | Impersonate | User.Identity.Name | WindowsIndentiy.GetCurrent() |
|-----------|-------------|--------------------|-------------------------------|
| Yes | True | Empty String | IUSR_<machineName> |
| Yes | False | Empty String | NT Authority\Network Service |
| No | True | domain\user | domain\user |
| No | False | domain\user | NT Authority\Network Service |
Run Code Online (Sandbox Code Playgroud)
传奇:
| 归档时间: |
|
| 查看次数: |
18993 次 |
| 最近记录: |