vendredi 31 mars 2017

Check if another action filter attribute is being used in action in MVC 5

I have few custom action filters like

public class CustomFilter:ActionFilterAttribute
{
  public override void OnActionExecuting(ActionExecutingContext filterContext)
  {
     //Some task
  }
}


public class CustomFilterNew:ActionFilterAttribute
{
  public override void OnActionExecuting(ActionExecutingContext filterContext)
  {
     //Some task
  }
}


In my action method

[CustomFilter]
[CustomFilterNew]
public ActionResult Index()
{
   return View();
}

Lets say CustomFilterNew exactly does opposite of CustomFilter.

In such case how to prevent one filter action from executing another filter action lets say CustomFilterNew should prohibit executing CustomFilter

Aucun commentaire:

Enregistrer un commentaire