1) You can check the start and end times of the request in the Begin_Request and End_Request events of the application class 2) You can define a custom HttpModule 3) You can define a custom attribute as follows:
public class RequestTimerAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
MarkTime("Start");
}
public override void OnResultExecuted(ResultExecutedContext filterContext)
{
MarkTime("End");
}
void MarkTime(string EventName)
{
}
}
source
share