• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 395
  • Last Modified:

ASP.NET: How to detect if user is locked out when using a LoginControl

I use a LoginControl and a custom membership provider for my web site. That works fine - I have only one question. If I set IsLockedOut=1 in table aspnet_Membership for a user and this user tries to login I would like to show a different message than the normal failure message.

So basically I need to find out about the reason of failure in the LoginError callback. Does anyone know how I can do that?

Regards,
Dirk.
0
dirkil2
Asked:
dirkil2
1 Solution
 
guru_samiCommented:
You need to hancle LoginError Event of login control.
Here is the exact example you need: http://www.4guysfromrolla.com/articles/050306-1.aspx
In case if you need C#: http://www.carlosag.net/Tools/CodeTranslator/
0
 
dirkil2Author Commented:
What I was missing was the following line:

MembershipUser user = Membership.GetUser(Login1.UserName);

I wasn't aware that you can still get access to the user in that case.

Thanks for giving me that interesting link.
0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now