在 MVC2 中使用 Windows 身份验证时获取 Active Directory 用户名
在使用 Windows 身份验证对 MVC2 网站上的用户进行身份验证后,我试图在控制器中获取 Windows 用户名。我怎样才能做到这一点?我知道您可以使用 Page.User.Identity.Name 从视图端获取它?那么控制器呢?
I am trying to get the windows username in my controller after using windows authentication to authenticate user on my MVC2 website. How can I do that? I know you can use Page.User.Identity.Name to get it from the view side? What about the controller though.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在控制器中访问它,如下所示:
You can access it in a Controller like so: