In MVC, a user can use an action filter as follows:
[Log]
ActionResult Home()
{
return View();
}
Now I'm going to find the equivalent of ActionFilter in an asp.net web form. How can I simulate the ones mentioned above for an asp.net web form and apply them to event handlers?
[Log]
protect void btnSearch_Click(object sender, EventArgs e)
{
}
Update:
To clarify my question (since the comment says my question is a bit ambiguous), I want to write down the beginning of the method and the end of the method. In Mvc, I can create an Action Filter as follows:
public class LogAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
}
public override void OnActionExecuted(ActionExecutedContext filterContext)
{
}
}
source
share