BlockDurationAttribute Class
This attribute allows you to configure a specific rule on a controller or a specific action end enables you to specify how long something should be blocked.
Implements the [System.Attribute]
Namespace:
Walter.Web.FireWall.AnnotationsAssembly: Walter.Web.FireWall (in Walter.Web.FireWall.dll)
Examples
Annotate a controller with Firewall annotations
using Microsoft.AspNetCore.Mvc; namespace MyProject.Controllers { using Walter.Web.FireWall; using Walter.Web.FireWall.Annotations; using Walter.BOM.Geo; [Geo(blockLocation: GeoLocation.AFRICA | GeoLocation.LATIN_AMERICA | GeoLocation.Netherlands)] [User(allow: UserTypes.IsHuman | UserTypes.IsSearchEngine)] [BlockDuration(duration: 60, sliding: true, doubleDurationPerIncident: true)] public sealed class HomeController : Controller { private readonly ILogger<HomeController> _logger; public HomeController(ILogger<HomeController> logger) { _logger = logger; } public IActionResult Index() { return View(); } public IActionResult Privacy() { return View(); } [Ignore] [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] public IActionResult Error() { return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier }); } } }