有没有办法在Controller级别添加属性,但不能在特定操作上添加.例如,如果我在我的控制器中有10个动作,那些动作中只有一个不需要我创建的特定属性.
[MyAttribute]
public class MyController : Controller
{
public ActionResult Action1() {}
public ActionResult Action2() {}
[Remove_MyAttribute]
public ActionResult Action3() {}
}
我可能会将此Action移动到另一个控制器(但不喜欢)或者我可以将MyAttribute应用于除Action3之外的所有操作,但只是想如果有更简单的方法?