When you have forms on your website (login forms, search forms, registration forms, etc) or any request that needs to do a lot of work, it's usually a good idea to throttle those requests to prevent automated scripts from using the form and overloading your server.

Add this statement to your Controller class:

using A4DN.Core.MVC.Base.Infrastructure.Attributes.Action;

Then add the [AB_RequestThrottle] to the request handlers you want to throttle:

[HttpPost]
[AB_RequestThrottle]
public ActionResult SubmitRegistration(DemoRegistrationModel model)
{
    ...
}

Each time this method is used, an entry is created/updated in HttpContext.Cache using the key "AB_RequestThrottle.SubmitRegistration.{IP Address}.Count. The initial value of the entry is 0 and it gets incremented for each use. The attribute will then delay processing the request by 200ms per access. So, the first time an IP address uses the method, the delay is 0ms, then 200ms, then 400ms, etc. If there are no requests for 5 minutes, the cache entry will be deleted and the counter is reset.

The timing can be adjusted by using optional arguments:

[AB_RequestThrottle(CooldownMinutes = 5, PerRequestSleepMS = 200)]