public interface IPageRequest : IInstrumented
public interface IPageRequest : IInstrumented
namespace MyWeb.Controllers { using Walter.Web.FireWall; using Walter.Web.FireWall.Annotations; using Walter.Web.FireWall.Filters; using Walter.Web.FireWall.Geo; using Walter.Web.FireWall.RuleEngine.Rules; [BlockDuration(seconds: 60, sliding: true, doubleDurationPerIncident: true)] public class HomeController : Controller { private readonly IPageRequest _page; private ILatLongRepository _latLongRepository; public HomeController(IPageRequest page, ILatLongRepository latLongRepository) { _page = page; _latLongRepository = latLongRepository; } [GeoIgnore(maxRequest: 5)] [Ignore(skip: FireWallGuardActions.RejectPenetrationAttempts | FireWallGuardActions.RejectRepeatViolations | FireWallGuardActions.RejectWrongUserType , skipCount: 5)] public IActionResult Blocked(BlockingReason id) { if (_page.User.AsFirewallUser().UserType.HasFlag(UserTypes.IsMalicious)) { return View("_Malicious", id); } return View(id); } [Minify] [HttpGet] [Users(blocked: UserTypes.IsMalicious , allow: UserTypes.IsHuman | UserTypes.IsSearchEngine | UserTypes.NotDiscovered , redirectToController: "home", redirectAction: "blocked", id: (int)BlockingReason.WrongConsumerType)] public async Task<IActionResult> Index() { if (!_page.User.TryReadCookie("Telephone", out var phone)) { phone = "001.123.567.89 ext 123"; } await _page.User.WriteCookieAsync("Telephone", phone, TimeSpan.FromSeconds(60)).ConfigureAwait(false); //_fireWall.SendEmail(EMailRoles.ProductUpdates, "test mail", "this is a test email", false);var model = new IndexModel(); model.UserQuery = new Query() { IPAddress = _page.IPAddress.ToString() }; model.UserResult = await _page.FireWall.WhoisAsync(_page).ConfigureAwait(false); model.Geography = _latLongRepository.QueryMapLocation(_page.IPAddress); return View(model); } } }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2