Walter.Web.FireWall
IPageRequest Interface
Members  Example 
Walter.Web.FireWall Assembly > Walter.Web.FireWall Namespace : IPageRequest Interface
Interface IPageRequest contains the meta data in as the firewall managed this page and it's access to it, a custom implementation of this Interface will be rejected by the firewall
Object Model
IPageRequest InterfaceIFireWall InterfaceDiscoveredRout ClassInteractions StructureSimpleLatLong StructureINotFoundRequest InterfaceIPageRequest InterfaceIUserIdentity Interface
Syntax
public interface IPageRequest : IInstrumented  
Remarks
A instance of IPageRequest is contract that contains scoped data storage populated with data related to the requesting user and is used when delivering a given page and is valid only for a given page request and is the class that is passed between the web application, the firewall, and the guard engines and is ultimately passed to storage and reporting interfaces.
Example
The bellow example shows how the IPageRequest can be used to access the requester related data as well as the firewall
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);
        }
    }
}
Requirements

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

See Also

Reference

IPageRequest Members
Walter.Web.FireWall Namespace