1. 继承AuthorizeAttribute类 ,
2. 重写方法AuthorizeCore。
3. 在Action方法上使用自定义的Attribute。
public class CustomAuthorizeAttribute : AuthorizeAttribute
{
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
// 添加验证逻辑
// return 验证结果
}
}