event EventHandler<PageCreatedEventArgs> OnResourceRequested
Event Data
The event handler receives an argument of type PageCreatedEventArgs containing data related to this event. The following PageCreatedEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Request | The page request generated before any filter or middleware had the ability to process it |
Remarks
This event in triggers when a firewall has been licensed
Example
The bellow sample shows how the event can be used to access the IPageRequest to populate a dictionary that counts access by country.
public class MyFireWall:FireWallBase { readonly IDictionary<GeoLocation?, int> _access = new ConcurrentDictionary<GeoLocation?, int>(); public MyFireWall(ILoggerFactory factory, IMemoryCache cache, ILatLongRepository geo) : base(loggerFactory: factory, memoryCache: cache, latLongRepository:geo) { base.Trigger_OnFireWallCreated(this); OnResourceRequested += FireWall_OnResourceRequested; } private void FireWall_OnResourceRequested(object sender, PageCreatedEventArgs e) { if (_access.TryGetValue(e.Request.Country, out var counter)) { _access[e.Request.Country] = counter + 1; } else { _access[e.Request.Country] = 1; } } }
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