Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6206561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:28:22+00:00 2026-05-24T05:28:22+00:00

I’ve noticed that forums are littered with examples of this problem, but with the

  • 0

I’ve noticed that forums are littered with examples of this problem, but with the only solutions referring to events not actually being hooked up, or typos. I’m pretty sure that my problem relates to neither of these!

I have a login control with an opening tag that looks like this:

<asp:Login ID="signInControl" FailureText="Sorry, your login has not been successful" runat="server" DisplayRememberMe="false" OnLoggedIn="signInControl_LoggedIn" OnAuthenticate="signInControl_Authenticate" OnLoggingIn="signInControl_LoggingIn">

Here are my events in the code-behind:

protected void signInControl_LoggedIn(object sender, EventArgs e)
        {
            MembershipProvider provider = Membership.Providers[GlobalConstants.MembershipProviderName];
            MembershipUser user = provider.GetUser(this.signInControl.UserName, true);

            int expiryInDays = Utility.GetConfigurationValueAsInt(SPContext.Current.Web, "PasswordExpiryLengthInDays");

            // provide a mechanism to stop password expiry (i.e. if -1);
            if (expiryInDays > 0)
            {
                expiryInDays = expiryInDays * -1;

                // If the user hasn't changed their password within the last x days, send them to update it.
                DateTime minimumPasswordChange = DateTime.Now.AddDays(expiryInDays);

                TimeSpan due = user.LastPasswordChangedDate.Subtract(minimumPasswordChange);

                Logging.LogTrace(string.Format("The user {0} next password change is in {1} days.", user.UserName, due.Days));

                if (user.LastPasswordChangedDate >= minimumPasswordChange)
                {
                    SPUtility.Redirect("/_layouts/ExpiredPassword.aspx", SPRedirectFlags.Trusted, this.Context);
                }
            }
            else
            {
                SPUtility.Redirect("/_layouts/ExpiredPassword.aspx", SPRedirectFlags.Trusted, this.Context);
            }
        }
protected void signInControl_Authenticate(object sender, AuthenticateEventArgs e)
        {
            SPClaimsUtility.AuthenticateFormsUser(new Uri(SPContext.Current.Web.Url), this.signInControl.UserName, this.signInControl.Password);
            e.Authenticated = Membership.ValidateUser(this.signInControl.UserName, this.signInControl.Password);
        }
protected void signInControl_LoggingIn(object sender, LoginCancelEventArgs e)
        {
            Logging.LogTrace(string.Format("User {0} attempting to sign in.", this.signInControl.UserName));
            e.Cancel = false;
        }

And as you can see in the authenticate event, e.authenticated is being set by whether the user can be validated. I’ve confirmed by stepping into the code that true is returned. So why isn’t my signInControl_LoggedIn method firing? I’m seriously confused!

This is the markup for the front-end:

Thanks for any help!

Karl.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T05:28:23+00:00Added an answer on May 24, 2026 at 5:28 am

    There are number of posts that describe how to create your own custom login page for SharePoint 2010. Here is the one I followed. In general, they create an application page that inherits from FormsSignInPage. For a page that just needs to change the look and feel, this works well. In some cases, like this one, creating the login page in this way may not be enough.

    The way it is described at the end of this post, you need to inherit from IdentityModelSignInPageBase instead of FormsSignInPage. You also need to create an event handler for the authenticate event and register this in the OnLoad event of the page.

    This is because the Authenticate method in the control will automatically take the user to the “ReturnUrl” page before it ever calls the OnLoggedIn event. It only takes two lines of code to authenticate the user in this method.

    void signInControl_Authenticate(object sender, AuthenticateEventArgs e)
    {
      Login signInControl = sender as Login;
      e.Authenticated = SPClaimsUtility.AuthenticateFormsUser(this.Page.Request.Url, signInControl.UserName, signInControl.Password);
    }
    

    Since your code now does not send the user to the ReturnUrl value, the OnLoggedIn event is reached.

    You may ask why do I need the OnLoggedIn event if I have to create a custom Authenticate method. Well, there are still functions the control will handle for you. For instance, if the user does not authenticate (ie bad UN and PW combination), the control will display the error message and the OnLoggedIn never fires.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I need a function that will clean a strings' special characters. I do NOT
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.