C# Class MvcThrottle.ThrottlingFilter

Inheritance: System.Web.Mvc.ActionFilterAttribute, IActionFilter
Show file Open project: stefanprodan/MvcThrottle

Public Methods

Method Description
OnActionExecuting ( System.Web.Mvc.ActionExecutingContext filterContext ) : void
ThrottlingFilter ( ) : System

Creates a new instance of the ThrottlingHandler class. By default, the QuotaExceededResponseCode property is set to 429 (Too Many Requests).

Protected Methods

Method Description
ComputeThrottleKey ( RequestIdentity requestIdentity, RateLimitPeriod period ) : string
QuotaExceededResult ( System.Web.Routing.RequestContext filterContext, string message, HttpStatusCode responseCode, string requestId ) : System.Web.Mvc.ActionResult
SetIdentity ( System.Web.HttpRequestBase request ) : RequestIdentity

Private Methods

Method Description
ApplyThrottling ( System.Web.Mvc.ActionExecutingContext filterContext, EnableThrottlingAttribute &attr ) : bool
ComputeLogEntry ( string requestId, RequestIdentity identity, MvcThrottle.ThrottleCounter throttleCounter, string rateLimitPeriod, long rateLimit, System.Web.HttpRequestBase request ) : ThrottleLogEntry
IsWhitelisted ( RequestIdentity requestIdentity ) : bool
ProcessRequest ( RequestIdentity requestIdentity, System.TimeSpan timeSpan, RateLimitPeriod period, string &id ) : MvcThrottle.ThrottleCounter
RetryAfterFrom ( System.DateTime timestamp, RateLimitPeriod period ) : string

Method Details

ComputeThrottleKey() protected method

protected ComputeThrottleKey ( RequestIdentity requestIdentity, RateLimitPeriod period ) : string
requestIdentity RequestIdentity
period RateLimitPeriod
return string

OnActionExecuting() public method

public OnActionExecuting ( System.Web.Mvc.ActionExecutingContext filterContext ) : void
filterContext System.Web.Mvc.ActionExecutingContext
return void

QuotaExceededResult() protected method

protected QuotaExceededResult ( System.Web.Routing.RequestContext filterContext, string message, HttpStatusCode responseCode, string requestId ) : System.Web.Mvc.ActionResult
filterContext System.Web.Routing.RequestContext
message string
responseCode HttpStatusCode
requestId string
return System.Web.Mvc.ActionResult

SetIdentity() protected method

protected SetIdentity ( System.Web.HttpRequestBase request ) : RequestIdentity
request System.Web.HttpRequestBase
return RequestIdentity

ThrottlingFilter() public method

Creates a new instance of the ThrottlingHandler class. By default, the QuotaExceededResponseCode property is set to 429 (Too Many Requests).
public ThrottlingFilter ( ) : System
return System