HttpContext.Current.User.Principal vs WindowsIdentity.GetCurrent() [英] HttpContext.Current.User.Principal vs WindowsIdentity.GetCurrent()

查看:157
本文介绍了HttpContext.Current.User.Principal vs WindowsIdentity.GetCurrent()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在HttpContext.Current.User.Principal和WindowsIdentity.GetCurrent()之间打开Windows身份验证和身份模拟的asp.NET环境有什么区别?

What's the difference in an asp.NET environment with Windows Authentication and Identity Impersonation turned on, between HttpContext.Current.User.Principal and WindowsIdentity.GetCurrent()?

推荐答案

根据 WindowsIdentity上的论坛.GetCurrent()。名称 User.Identity.Name



  • User.Identity.Name 表示从IIS传递的身份。

  • WindowsIdentity.GetCurrent()。Name 是线程运行的标识。

  • User.Identity.Name represents the identity passed from IIS.
  • WindowsIdentity.GetCurrent().Name is the identity under which the thread is running.

根据您在IIS中的应用程序身份验证设置,它们将返回不同的值:

Depending on your app's authentication settings in IIS, they will return different values:

| 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  |

传奇


  • domain \ user 将显示为:


    • domain \ user活动目录

    • 本地帐户的machineName \ userName

    • Where domain\user will show up as:
      • domain\user for Active Directory
      • machineName\userName for local account

      • NT Authority \ Windows Server或ASP.NET的网络服务

      • 适用于Windows XP的machineName \ ASPNET_WP

      这篇关于HttpContext.Current.User.Principal vs WindowsIdentity.GetCurrent()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆