【问题标题】:Getting the Active Directory username when using Windows Authentication in MVC2在 MVC2 中使用 Windows 身份验证时获取 Active Directory 用户名
【发布时间】:2011-08-10 19:48:37
【问题描述】:

在我的 MVC2 网站上使用 Windows 身份验证对用户进行身份验证后,我试图在我的控制器中获取 Windows 用户名。我怎样才能做到这一点?我知道您可以使用 Page.User.Identity.Name 从视图端获取它?但是控制器呢。

【问题讨论】:

    标签: asp.net-mvc-2 active-directory windows-authentication


    【解决方案1】:

    您可以像这样在控制器中访问它:

    this.HttpContext.User.Identity.Name
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多