How does login control work in asp.net




















The Login control supports the next events:. Raised to authenticate the user. If you handle this event, you have to authenticate the user on your own, and the Login control completely relies on your authentication code.

Raised when the login of the user failed for some reason such as a wrong password or user name. The next example shows how you can use the LoginError event to automatically redirect the user to the password recovery page after a specific number of attempts:.

If you are planning to handle the event, you have to add your own code for validating the user name and password. The Authenticate event receives an instance of AuthenticateEventArgs as a parameter. Exit Select. Case Else. End Select. End Sub. Home Page. After successful login user will be redirected to this page. In this page I have made use of ASP. Verify whether User has Logged In. Inside the Page Load event, first we verify whether the User is authenticated using the IsAuthenticated property.

RedirectToLoginPage ;. EventArgs Handles Me. If Not Me. IsAuthenticated Then. End If. Config Configuration. You will need to add the following configuration in the Web. Related Articles. Add Comments. Thank you for the feedback. The comment is now awaiting moderation. You will be notified via email when the author replies to your comment. Please select a comment to reply. You can add your comment about this article using the form below.

Make sure you provide a valid email address else you won't be notified when the author replies to your comment Please note that all comments are moderated and will be deleted if they are Not relavant to the article Spam Advertising campaigns or links to other sites Abusive content. Please do not post code, scripts or snippets. Required Invalid Email Address. Question: It refers the view where the user can enter the answer to the security question.

UserName: It refers to the view where the user can enter the username for the password to be recovered. Success: It represents the view where the message is displayed to the user. The control contains various properties, methods and events as mentioned below: Methods of the PasswordRecovery Control OnSendingMail: It raises the SendingMail event when the user is verified and the password is sent to the user.

OnVerifyingUser: It raises the event once the username is submitted, and the membership provider verification is pending.

Properties of the control Answer: The answer provided by the user to confirm the password recovery through the valid user FailureTextStyle: It accesses the reference to the collection of properties defining the error text look HelpPageIconUrl: It image to be displayed for the link to the password is retrieved Events of the control SendingMail: It is initiated when the server is sending an email message containing the password once the answer is correct AnswerLookupError: It is initiated when the user answer to the question is incorrect VerifyingAnswer: It is initiated when the user has submitted the answer to the password recovery confirmation question The PasswordRecovery control at the design time is as shown below: 6.

The control can be extended to the existing Wizard control. The control can be customized through templates and properties. Some of the properties, methods and events related to the control are as mentioned below: Properties of the Control Answer: It retrieves or specifies the answer to the password recovery confirmation question. CompleteStep: It shows the final step of the process for creating the user account. ContinueButtonText: It accesses or specifies the collection of properties defining the look of the control Email: It retrieves the email address of the user LoginCreatedUser: It accesses or specifies the value indicating the new user login once the account is created.

Events of the control CreatedUser: It is initiated after the membership service provider has created a new user account CreatingUser: It is initiated before the membership service provider is called for creating user account SendingMail: It is initiated before sending the conformation email on the successful creation of the account SendMailError: It is initiated when the SMTP error occurs during the mail sent to the user.

The CreateUserWizard control at the design time is as shown below: 7. ChangePassword Control The control helps user to change the password. The user adds the current password and adds the new password. If the old password is incorrect, the new one cannot be added. CurrentPassword: It retrieves the current password of a user.

DisplayUserName: It retrieves the value indicating whether the ChangePassword control should be display the control and label NewPassword: It retrieves the new password entered by the user UserName: It shows the username for which the password is to be modified.

Events of the control ChangedPassword: It is initiated when the password is changed for the user account. NET application. Perform the following steps to demonstrate the implementation of the login controls in application. Place the login control in the. Click the Security link in the window Click the Use the security Setup Wizard to configure security step by step link to open the setup wizard Click Next button in the welcome the security setup wizard.

Click the From the Internet radio button and click the Next button. Click the Next button in the Advance provider settings page. Select the Enable roles for this web site check box and click the Next button Add the details in the text boxes and click the Create User button to create the user account.

Select the All Users radio button in the Rule applies to section. Click the Add this Rule button. Execute the application and enter the username and password in the text boxes.



0コメント

  • 1000 / 1000