开发者

How do I disable an account with the ASP.NET Membership Provider?

I'm using asp.net membership provider. and I need to block user account in case if the user post spam. How can I accomplish it using build in features of the Membership Provider.

Can I use Is开发者_开发问答LockedOut? If so how can i update it programmatically?

Thank you


MembershipUser user = Membership.GetUser("Yourusername");
if(user!=null){
user.IsApproved=false;
Membership.UpdateUser(user);
}


There isn't an exposed method to do so, but you can always code a sproc and a helper method to do that for you.

Alternately, code a loop to lock them out with programmatic code ;)

for (i=0;i<lockoutTries;i++) membership.login(username,badpassword_constant);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜