make sure each controller method has a ValidateAntiForgeryToken attribute?

前端 未结 4 1516
温柔的废话
温柔的废话 2020-12-24 04:23

Is there any way to centralize enforcement that every action method must have a \"ValidateAntiForgeryToken\" attribute? I\'m thinking it would have to be done by extending

4条回答
  •  温柔的废话
    2020-12-24 05:11

    How about this?

    [ValidateAntiForgeryToken]
    public class MyBaseController : Controller
    {
    }
    

提交回复
热议问题