Health monitoring System in asp.net 2.0 (Health monitoring) (3)

Source: Internet
Author: User
Tags config

Original address: Http://aspnet.4guysfromrolla.com/articles/031407-1.aspx

Introduced

In previous articles (translator Note: ASP.net 2.0 health Monitoring System (Health monitoring) (1)-basic applications, ASP.NET 2.0 Health monitoring System (Health monitoring) (2)- By emailing the monitoring information, we already know that the ASP.net 2.0 health monitoring system is used to monitor the operation of the ASP.net application, and it can log event information to the log source you specify. This health monitoring system includes a large number of predefined events that automatically trigger related events during the ASP.net program's operation. However, sometimes we need to use our own logic to trigger an event, at which point we should create our own custom events for the health monitoring system.

In this article, we'll see how to create a custom event, and how to trigger this custom event. When the predefined events of the health monitoring system are triggered, the health monitoring system decides which log source to record the detailed event information through the configuration information in the web.config. In this article, we create a custom event that logs the information to the relevant log source when a locked user attempts to log in. Keep looking down and you'll know more!

Need to know the point of knowledge

The ASP.net 2.0 membership allows developers to easily develop user-managed functionality. For more information on ASP.net 2.0 user management, refer to examining ASP.net 2.0 's membership, Roles, and profile. For security purposes, membership locks the user if a user has failed to log in more than a certain number of times over a period of time. Once a user is locked out, he will no longer be able to log on to the site until the administrator unlocks the account. Refer to part 4th of the series of articles recommended above, which describes how to log the logged on of a locked user to a database so that administrators can view it, allowing administrators to centrally manage locked users through an interface, while also providing the ability to understand lock users.

We can enhance the above function so that it can record the locked user who is trying to log on through the health monitoring system. OK, let's do some necessary configuration so that when the relevant events occur, the system will automatically send the message to the administrator. (Refer to Email for monitoring information (in Chinese here), you can learn more about the health monitoring system through the message to record events in the relevant information. )

Although by default, ASP. NET runtime can record different levels of validation events, but if a user fails because the user is locked out, it cannot be logged. In addition, it is not a built-in event for a health monitoring system. So please follow me to complete the following 3 tasks:

1. Create a custom event class (it will be triggered when a locked user tries to log in)

2. When the locked user tries to log in, it triggers the event that we created in the first step.

3. Update the configuration associated with the health monitoring system in web.config so that it can record custom events to one or more data sources.

The following sections of this article will explain in detail how to complete these 3 steps. If you haven't seen examining ASP.net 2.0 's membership, Roles, and Profile-part 4, please take a look at it now, as the code in the article will be used.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.