public async Task Invoke(HttpContext context) { CurrentRequestLog = WebRequestLogFactory?.Invoke(); CurrentRequestLog.SessionId = context.Session.Id; await Next.Invoke(context); await CurrentRequestLog.Perform(async x => await x.Record(HttpContextAccessor.HttpContext)); }
public static void Register(HttpApplication app) { if (!IsEnabled) { return; } app.BeginRequest += (s, e) => CurrentRequestLog = WebRequestLogFactory?.Invoke(); app.EndRequest += (s, e) => CurrentRequestLog.Perform(x => x.Record(HttpContext.Current)); app.AcquireRequestState += (s, e) => { try { CurrentRequestLog.SessionId = HttpContext.Current.Session.SessionID; } catch { } }; }