3"> 3">

Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 CS 3870/CS 5870: Note 12 Membership Class. 2 Logging in User Programmatically If Membership.ValidateUser(txtUserName.Text, txtPassword.Text) Then FormsAuthetication.RedirectFromLoginPage(...)

Similar presentations


Presentation on theme: "1 CS 3870/CS 5870: Note 12 Membership Class. 2 Logging in User Programmatically If Membership.ValidateUser(txtUserName.Text, txtPassword.Text) Then FormsAuthetication.RedirectFromLoginPage(...)"— Presentation transcript:

1 1 CS 3870/CS 5870: Note 12 Membership Class

2 2 Logging in User Programmatically If Membership.ValidateUser(txtUserName.Text, txtPassword.Text) Then FormsAuthetication.RedirectFromLoginPage(...) Else lblErr.Text = “Incorrect UserName or Password!” End If

3 Invalid Password <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="LocalSqlServer" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="7" minRequiredNonalphanumericCharacters="1" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/> 3

4 4 Locking Out User with Bad Password If Membership.ValidateUser(txtUserName.Text, txtPassword.Text) Then FormsAuthetication.RedirectFromLoginPage(...) Else Dim user As MembershipUser = Membership.GetUser(txtUserName.Text) lblErr.Text = “Locked out value: ” & user.IsLockedout().ToString() End If

5 5 Unlocking a User Dim user As MembershipUser = MembershipGetUser(txtUserName.Text) user.UnlockUser()

6 Showing Number of Users Online Page_Load Event lblNumUsers.Text = “There are ” & Membership.GetNumberOfUsersOnline().ToString() 6

7 7 Lab5MasterPage The LoginName and LoginStatus should be displayed to the left side and right side of "Lab 5", respectively. Code (VB or C#) file Protected Sub LoginStatus1_LoggedOut(...) Handles... Response.Redirect("~/Login.aspx") End Sub

8 Lab 5 8


Download ppt "1 CS 3870/CS 5870: Note 12 Membership Class. 2 Logging in User Programmatically If Membership.ValidateUser(txtUserName.Text, txtPassword.Text) Then FormsAuthetication.RedirectFromLoginPage(...)"

Similar presentations


Ads by Google