An action filter is an attribute which you can apply over the entire controller or over its particular action.
Action filters in MVC are the attribute that can be used according to the user need before or after the program gets executed.
Action filter can be implemented using an ActionFilter attribute.
Action filters are associated with action performed in controllers before or after the program executes.
using System;
using System.Web.Mvc;
namespace MvcApplication1.Controllers
{
public class DataController : Controller
{
[OutputCache(Duration=10)]
public string Index()
{
return DateTime.Now.ToString("T");
}
}
}
Action filter are used when we want to add something before or after the execution of program.
0 Comment(s)