Walter.BOM Namespace
Walter.Web.FireWall Namespace
ASP-WAF Web application firewall for .Net 6, .Net 5, .Net Standard 2.1 and .Net Core 3.x

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.Annotations
Assembly:  Walter.Web.FireWall (in Walter.Web.FireWall.dll)

Syntax


public sealed class BlockDurationAttribute

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 });
   }
   }
   }