【发布时间】:2011-08-10 19:48:37
【问题描述】:
在我的 MVC2 网站上使用 Windows 身份验证对用户进行身份验证后,我试图在我的控制器中获取 Windows 用户名。我怎样才能做到这一点?我知道您可以使用 Page.User.Identity.Name 从视图端获取它?但是控制器呢。
【问题讨论】:
标签: asp.net-mvc-2 active-directory windows-authentication
在我的 MVC2 网站上使用 Windows 身份验证对用户进行身份验证后,我试图在我的控制器中获取 Windows 用户名。我怎样才能做到这一点?我知道您可以使用 Page.User.Identity.Name 从视图端获取它?但是控制器呢。
【问题讨论】:
标签: asp.net-mvc-2 active-directory windows-authentication
您可以像这样在控制器中访问它:
this.HttpContext.User.Identity.Name
【讨论】: