locked
How to get start time of a HTTP request in an IIS Module? RRS feed

  • Question

  • public class HelloWorldModule : IHttpModule
    {
    
        private void Application_BeginRequest(Object source, EventArgs e)
        {
            HttpApplication application = (HttpApplication)source;
            HttpContext context = application.Context;
    
            var startTime = context.Timestamp;
        }
    }


    context.Timestamp is the time when we actually start to process the HTTP request(exclude network and queue(in thread pool) time), not the time when IIS first receive the HTTP request which is the start time of time-taken field of IIS access log.

    How can I get the "start time" used by the calculation of time-taken field in a IIS Module? Thanks!

    EDIT:

    time-taken field of IIS access log will include network and queue time. https://support.microsoft.com/en-us/help/944884/description-of-the-time-taken-field-in-iis-6-0-and-iis-7-0-http-loggin

    Friday, October 13, 2017 6:57 AM

All replies