Hmm. I'm still receiving the following even when using the LoginError event.
Can't find much of anything about these BubbleEvents. Anyone got some useful 
ideas?
Object reference not set to an instance of an object.   at 
SP.FBA.Login.login_LoginError(Object sender, EventArgs e)
   at System.Web.UI.WebControls.Login.OnLoginError(EventArgs e)
   at System.Web.UI.WebControls.Login.AttemptLogin()
   at System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e)
   at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
   at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler 
sourceControl, String eventArgument)
   at System.Web.UI.Page.ProcessRequestMain(Boolean 
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
I'm not trying to do anything apart from check the status fo the account and 
provide suitable feedback to the user.

protected void login_LoginError(object sender, EventArgs e)
{
      // Determine why the user could not login...
      FailureText.Text = "Your login attempt was not successful. Please try 
again.";

      // Validate username
      InitialiseUser();

      if (user != null)
{
            // Is this user locked out?
            if (user.IsLockedOut)
            {
                  FailureText.Text = string.Format("<p>The account with ID 
<b>{0}</b> has been locked due to successive failed login 
attempts.</p><p><b>The email address associated with this account is: 
{1}</b></p><p>An email has been sent to the site administrator.</p>", user, 
user.Email);
                return;
            }
            // Is the user approved?
            else if (!user.IsApproved)
            {
                  FailureText.Text = "Your account has not yet been approved. 
You cannot login until an administrator has approved your account.";
            }
      }
}

Regards,

Paul

--
Online Developer/SharePoint Administrator,
ICT Infrastructure Team
CEO Sydney

From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of 
Paul Noone
Sent: Friday, 5 August 2011 1:53 PM
To: ozMOSS
Subject: RE: SQL Membership Provider - Lockeuser question

S'ok. I was half right. :)
Apparently I should be using the LoginError event which captures locked out 
users as well as general authentication failures.
From: ozmoss-boun...@ozmoss.com [mailto:ozmoss-boun...@ozmoss.com] On Behalf Of 
Paul Noone
Sent: Friday, 5 August 2011 1:20 PM
To: ozMOSS (ozmoss@ozmoss.com)
Subject: SQL Membership Provider - Lockeuser question

Hi all,
We have an FBA app that uses a simplfieid version of the FBA Users project on 
Codeplex.

I have a small issue where users are being locked out (correctly) but not 
receiving adequate feedback.

I am trying to check the IsLockedOut status of a locked out user during login 
but am getting the exception message when running the following.

private void InitialiseUser()
{
    var username = UserName.Text;

    try
    {
      user = Membership.GetUser(username);
    }
    catch (Exception ex)
    {
      Lblerror.text = ex.Message;
    }
}

Could this be because locked out users immediately return an exception?

The associated event code is:

Event code: 4005
Event message: Forms authentication failed for the request.
Reason: The ticket supplied has expired.
Event sequence: 2
Event occurrence: 1
Event detail code: 50202
_______________________________________________
ozmoss mailing list
ozmoss@ozmoss.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozmoss

Reply via email to