Log In Page - Creating a Custom Membership Provider and Membership User utilizing a Data Set Table Adapter - Step 12

On our Log In Page, we use a custom Remember Me checkbox instead of the checkbox included with the log in control. This way we can remove our log in cookie ourselves and do any database changes needed to log the user out.

Since we are using a Log In control, notice in our codebehind how we retrieve the Remember Me cookie using the FindControl to find our Login control and then the FindControl again to find the RememberMe checkbox within the Login control. Also, notice how we must find the UserName field in order to set focus on that control.

              Dim lctrl As Login
                lctrl = CType(LoginView1.FindControl("Login1"), Login)

  Dim chk As CheckBox = CType(lctrl.FindControl("RememberMeCustom"), CheckBox)

      Dim tb As TextBox = CType(lctrl.FindControl("UserName"), TextBox)
                FormUtility.SetFocusControl(tb)

Read the complete article with source code here...

1 Comment

Comments have been disabled for this content.