【问题标题】:What is the equivalent of the 'HttpContext.Current.User.Identity' for a Windows application?Windows 应用程序的“HttpContext.Current.User.Identity”等价物是什么?
【发布时间】:2018-04-11 16:14:59
【问题描述】:

根据我的研究,我认为 HttpContext 不能用于 Windows 应用程序。 我想为我的 Windows 应用程序使用等效的 HttpContext 来实现类似这样的东西,例如:

Dim userName = HttpContext.Current.User.Identity.Name

【问题讨论】:

    标签: asp.net vb.net windows-applications httpcontext


    【解决方案1】:

    Environment.Username 应该为当前登录的用户做这个伎俩,WindowsIdentity.GetCurrent() 将为应用程序的线程获取用户。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-05
      • 1970-01-01
      • 2011-01-31
      • 1970-01-01
      • 1970-01-01
      • 2016-02-10
      • 1970-01-01
      • 2022-01-11
      相关资源
      最近更新 更多