Nannette Thacker ShiningStar.net

ASP.net Web Application Development

Sponsors

News

See all Blog Posts by Nannette.

Nannette Thacker, consultant and owner of Shining Star Services LLC, specializes in development of custom dynamic database driven web applications utilizing ASP.net technologies. Nannette has been developing ASP sites since 1997. Nannette has written numerous articles on web development techniques and tutorials.

Nannette is the owner and developer of ChristianSinglesDating.com.

 Subscribe in a reader





View Nannette  Thacker's profile on LinkedIn

October 2008 - Posts

Register Page - Creating a Custom Membership Provider and Membership User utilizing a Data Set Table Adapter - Step 13

On our Registration page, we'll look at a few Regular Expressions. We'll use client side validation using the RequiredFieldValidator and also the RegularExpressionValidator. On server side, we'll again check our validations using our FormUtility class and some Regex regular expressions defined there.

See the complete source code and article here...

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...

Cookie Handler class - Creating a Custom Membership Provider and Membership User utilizing a Data Set Table Adapter - Step 11

When we log in to the site, we optionally set a Remember Me cookie. This cookie is checked each time the Master Page is loaded, so that if the user is not logged in, they are auto-logged into the web site. Below are our cookie handling classes:

Our AppCookie.vb class is a generic handler for all cookies. Our SSSCookie.vb class is specifically for the current application.

Read the complete article here...

Our Master Page - Creating a Custom Membership Provider and Membership User utilizing a Data Set Table Adapter - Step 10

Continuing our series, we look at our source code for our Master Page.

In this section, we demonstrate how to set our UserName property as Bindable so that it can be used in controls.

In our Master Page, we check if the user is logged in, and if not, we check the user's cookies to see if they had selected the Remember Me checkbox on the Log in page.

Read the complete article here...

Our Custom RoleProvider Class - Creating a Custom Membership Provider and Membership User utilizing a Data Set Table Adapter - Step 9

We continue our series by displaying our source code for our Custom RoleProvider class.

Read the entire article here...

Customizing our MembershipProvider Class - Creating a Custom Membership Provider and Membership User utilizing a Data Set Table Adapter - Step 8

In this series, we are now ready to customize our MembershipProvider class. We will use a custom Remember Me log in cookie.

 Our ValidateUser, CreateUser, and GetUser methods are written using table adapters.

In this article, we explain the problem with: Response.Redirects and ThreadAbortException

Read the entire article here...

 

Creating Our Custom MembershipUser Class - Creating a Custom Membership Provider and Membership User utilizing a Data Set Table Adapter - Step 7

We are now ready to create our custom MembershipUser Class. First create a new class and add it to your ProviderClasses directory.

Add "Inherits MembershipUser."

ChangePassword in MembershipUser versus MembershipProvider

The system automatically calls the MembershipProvider "ChangePassword" method first, so your MembershipProvider method will never be implemented unless you call it in this method as below:

#Region "ChangePassword Functionality"
        ' http://devauthority.com/blogs/jwooley/archive/2006/08/25/2208.aspx
        ' system automatically calls this one first, since the membershipuser has its 
        ' own method, use this to call the membershipprovider changepassword...
        Public Overrides Function ChangePassword(ByVal oldPassword As String, _
        ByVal newPassword As String) As Boolean
            ' Validate the old password for user 
            If Membership.Provider.ValidateUser(Me.UserName, oldPassword) Then
                Return Membership.Provider.ChangePassword(Me.UserName, _
                oldPassword, newPassword)
            Else ' Incorrect username/password combination.
                Return False
            End If
        End Function

#End Region
Read the complete article here...
Adding Properties to Our Custom MembershipProvider Class - Creating a Custom Membership Provider and Membership User utilizing a Data Set Table Adapter - Step 6

We now want to setup our properties for our custom SSSMembershipProvider class. In the below block of code, we will define variables to use in pulling the properties as setup within the web.config file.

#Region "Properties from web.config"
    ' Properties from web.config, default all to False
    Private m_EnablePasswordReset As Boolean = False
    Private m_EnablePasswordRetrieval As Boolean = False
    Private m_RequiresQuestionAndAnswer As Boolean = False
    Private m_RequiresUniqueEmail As Boolean = False
    Private m_ApplicationName As String = String.Empty
    Private m_PasswordStrengthRegularExpression As String = String.Empty
    Private m_MaxAllowedPasswordLength As Integer = 0
    Private m_MaxInvalidPasswordAttempts As Integer = 0
    Private m_MinRequiredNonAlphanumericCharacters As Integer = 0
    Private m_MinRequiredPasswordLength As Integer = 0
    Private m_PasswordAttemptWindow As Integer = 10
    Private m_PasswordFormat As System.Web.Security.MembershipPasswordFormat = MembershipPasswordFormat.Clear
#End Region

Read the complete article here... 

 

Creating our Custom MembershipProvider Class - Creating a Custom Membership Provider and Membership User utilizing a Data Set Table Adapter - Step 5

We want to now create our Custom Membership Provider class. Right click the ProviderClasses folder that you created in Step 1 and select "Add New Item."

 Select the "Class" template, name the new provider "SSSMembershipProvider" (or whatever name you desire) and select "Add."

A new class named "SSSMembershipProvider" will open. Type "Inherits MembershipProvider" following the "Public Class SSSMembershipProvider" declaration.

Read the complete article here...

Creating the Table Adapter Methods for GetUserByLogin, GetUserByUserName, and InsertUser

As we continue this series...

Since we are going to implement the ValidateUser, GetUser, and CreateUser methods, we will need queries for each. We will create 3 new queries to add to our adapter for these methods: GetUserByLogin, GetUserByUserName, and InsertUser.

Read more here...

More Posts Next page »