过滤器
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = true, AllowMultiple = false)]
public class RequireSslAttribute :FilterAttribute, IAuthorizationFilter
{
public bool Require { get; set; }
public RequireSslAttribute()
{
Require = true; //디폴트는 TRUE
}
public void OnAuthorization(AuthorizationContext filterContext)
{
filterContext.Result = new RedirectResult("");
}
}
public class BlackList : AuthorizeAttribute
{
public void BlackList(bool isShow)
{
}
protected override bool AuthorizeCore(HttpContextBase httpContext)
{
return false;
}
protected virtual void HandleUnauthorizedRequest(AuthorizationContext filterContext) {
filterContext.Result = new RedirectResult("");
}
}