public void Init(HttpApplication context) { if (webLogger == null) { return; } context.BeginRequest += context_BeginRequest; context.Error += context_Error; EventHandlerTaskAsyncHelper asyncHelper = new EventHandlerTaskAsyncHelper(context_LogRequest); context.AddOnLogRequestAsync(asyncHelper.BeginEventHandler, asyncHelper.EndEventHandler); }
public void RegisterEvent(HttpApplication application) { switch (ApplicationEvent) { case DynamicHttpHandlerEvent.AuthenticateRequestAsync: application.AddOnAuthenticateRequestAsync(asyncHandlerHelper.BeginEventHandler, asyncHandlerHelper.EndEventHandler); break; case DynamicHttpHandlerEvent.AuthorizeRequestAsync: application.AddOnAuthorizeRequestAsync(asyncHandlerHelper.BeginEventHandler, asyncHandlerHelper.EndEventHandler); break; case DynamicHttpHandlerEvent.BeginRequestAsync: application.AddOnBeginRequestAsync(asyncHandlerHelper.BeginEventHandler, asyncHandlerHelper.EndEventHandler); break; case DynamicHttpHandlerEvent.EndRequestAsync: application.AddOnEndRequestAsync(asyncHandlerHelper.BeginEventHandler, asyncHandlerHelper.EndEventHandler); break; case DynamicHttpHandlerEvent.LogRequestAsync: application.AddOnLogRequestAsync(asyncHandlerHelper.BeginEventHandler, asyncHandlerHelper.EndEventHandler); break; case DynamicHttpHandlerEvent.PostAuthenticateRequestAsync: application.AddOnPostAuthenticateRequestAsync(asyncHandlerHelper.BeginEventHandler, asyncHandlerHelper.EndEventHandler); break; case DynamicHttpHandlerEvent.PostAuthorizeRequestAsync: application.AddOnPostAuthorizeRequestAsync(asyncHandlerHelper.BeginEventHandler, asyncHandlerHelper.EndEventHandler); break; case DynamicHttpHandlerEvent.PostLogRequestAsync: application.AddOnPostLogRequestAsync(asyncHandlerHelper.BeginEventHandler, asyncHandlerHelper.EndEventHandler); break; case DynamicHttpHandlerEvent.BeginRequest: application.BeginRequest += HandleRequest; break; case DynamicHttpHandlerEvent.AuthenticateRequest: application.AuthenticateRequest += HandleRequest; break; case DynamicHttpHandlerEvent.PostAuthenticateRequest: application.PostAuthenticateRequest += HandleRequest; break; case DynamicHttpHandlerEvent.AuthorizeRequest: application.AuthorizeRequest += HandleRequest; break; case DynamicHttpHandlerEvent.PostAuthorizeRequest: application.PostAuthorizeRequest += HandleRequest; break; case DynamicHttpHandlerEvent.PostLogRequest: application.PostLogRequest += HandleRequest; break; case DynamicHttpHandlerEvent.LogRequest: application.LogRequest += HandleRequest; break; case DynamicHttpHandlerEvent.EndRequest: application.EndRequest += HandleRequest; break; case DynamicHttpHandlerEvent.Error: application.Error += HandleRequest; break; default: throw new ApplicationException($"Async event type '{ApplicationEvent}' not configured for registrations"); } }