Alternatively, we could manage the approved and locked out statuses through a separate ASP. I decided not to replicate that functionality in the code associated with this tutorial because it worked by circumventing the Membership API and operating directly with the SQL Server database to change a user's password. Is Post Back Then ' If querystring value is missing, send the user to Manage Dim user Name As String = Request. Get User(user Name) If usr Is Nothing Then Response. Checking or unchecking the Check Box or clicking the Unlock User button causes a postback, but no modifications are made to the user account because we've yet to create event handlers for these events. Query String("user") Dim usr As Membership User = Membership. Because the user is not approved, they cannot login.This tutorial starts from scratch with the Protected Sub Page_Load(By Val sender As Object, By Val e As System. Redirect("Manage Users.aspx") End If User Name Label. Return to Visual Studio and create event handlers for the Protected Sub Is Approved_Checked Changed(By Val sender As Object, By Val e As System. Checked Changed 'Toggle the user's approved status Dim user Name As String = Request. By default, the Login control displays the same message if the user cannot login, regardless of the reason.With this model, when a new user signs up they are sent an email message that includes a link to a verification page. Application Path Dim verify Url As String = "/Verification.aspx? To String() Dim full Url As String = url Base & verify Url ' Replace replaced with the full URL.By visiting the link the user has proven that they received the email and, therefore, that the email address provided is valid. The net effect is that new users are unapproved, meaning that they cannot log into the site.This tutorial shows how to build a web page for administrators to manage users' locked out and approved statuses.We will also see how to approve new users only after they have verified their email address.Once you have unlocked the user, they will be able to login again.
This may happen automatically, thereby approving any user who reaches this page, or only after the user provides some additional information, such as a CAPTCHA. Provider User Key, Guid) ' Determine the full verification URL (i.e., Figure 6: The New User Receives an Email with a Link to the Verification URL (Click to view full-size image) Note The Create User Wizard control's default Create User Wizard step displays a message informing the user their account has been created and displays a Continue button.In the tutorial we constructed a page that listed each user account in a paged, filtered Grid View.The grid lists each user's name and email, their approved and locked out statuses, whether they're currently online, and any comments about the user. Year Check Box is only checked if the user is approved.To manage users' approved and locked out statuses, we could make this grid editable. If the user has ever been locked out, their last locked out date is displayed. Text = "The user account has been unlocked." End Sub property was successfully modified.
To change a user's approved status, the administrator would first locate the user account and then edit the corresponding Grid View row, checking or unchecking the approved checkbox. NET pages: page provides an interface for changing the selected user's password. Redirect("Manage Users.aspx") End If ' Get information about this user Dim usr As Membership User = Membership. The Unlock User button is enabled only if the user is currently locked out. Text = "The user's approved status has been updated." End Sub Protected Sub Unlock User Button_Click(By Val sender As Object, By Val e As System. Click 'Unlock the user account Dim user Name As String = Request. Figure 3: Chris has been Unapproved (Click to view full-size image) Next, logout and try to login as the user whose account was just unapproved.To prevent this from happening you could move the signup page to an folder, and require that an administrator manually create each account.