简体   繁体   English

如何使用ASP.NET成员资格跟踪WPF中的CurrentUser

[英]How to keep track of CurrentUser in WPF using ASP.NET Membership

I have the following needs. 我有以下需求。 I am using ASP.NET Membership installed into my database. 我正在使用安装到数据库中的ASP.NET Membership。 I need to create a WPF application which needs to have login functionality. 我需要创建一个需要具有登录功能的WPF应用程序。 I have imported the System.Web.Security namespace so I can validate and create users with Membership static methods. 我已经导入了System.Web.Security命名空间,因此可以使用Membership静态方法验证和创建用户。 My question is if there is something similar to keep track which user is logged (like HttpContext.Current.User.Identity in ASP.NET)? 我的问题是是否有类似的东西来跟踪记录了哪个用户(例如ASP.NET中的HttpContext.Current.User.Identity)? Whats the way to get the userID (guid) other than searching the database for user by username? 除了通过用户名在数据库中搜索用户以外,如何获取用户ID(GUID)? Thank you in advance 先感谢您

尝试使用System.Security.Principal.WindowsIdentity.GetCurrent()Environment.UserName属性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM