C# 使用asp.net 会员提供程序如何检查用户是否已注册?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/500061/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-04 05:47:28  来源:igfitidea点击:

using asp.net membership provider how to check if the user is registered or not?

c#.netasp.netmembershipprovider

提问by ahmed

using asp.net and c# membership provider how to check if the user is registered or not? I want to handle this in code not by using "login status"?

使用asp.net 和c# 会员提供程序如何检查用户是否已注册?我想在代码中处理这个而不是使用“登录状态”?

采纳答案by Glennular

Not sure if you want to know if they are a "registered" user or have logged in (as the Login status would indicate)

不确定您是否想知道他们是“注册”用户还是已登录(如登录状态所示)

Here's to know if they are logged in (what the Login status uses):

这是要知道他们是否已登录(登录状态使用什么):

System.Web.HttpContext.Current.User.Identity.IsAuthenticated;

回答by Rex M

MembershipProvider.GetUser(string username, bool updateLastActivityDateTime)

This will get you the user, or return null of the user does not exist (has not been registered)

这将获得您的用户,或返回用户不存在的空值(尚未注册)