I have enabled IIS logging with custom fields for my website.
Previously in MVC, I have used HTTPHandlers and Module to add the above fields to the HTTP Request headers.
web.config:
<modules runAllManagedModulesForAllRequests="true">
<!--Handler to process the IIS logs of the site Pagevisit logs-->
<add name="IISLogger" type="MySite.Website.MvcApplication.Utils.IISLogHandler, MySite.Website.MvcApplication" />
</modules>
IISLogHandler class:
public class IISLogHandler : IHttpModule
{
public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(context_BeginRequest);
}
private void context_BeginRequest(object sender, EventArgs e)
{
var request = (sender as HttpApplication).Request;
request.Headers["IIID"] = iiid;
request.Headers["IID"] = !string.IsNullOrEmpty(customerId) ?
customerId : iid;
}
}
My Generated log:
How do i migrate this to ASPNET Core 2.2.0 ?