Get Response Content Length in Global.asax Application_EndRequest function?

193 views Asked by At

I am adding some diagnostics logging to my ASP.NET MVC application. This happens by writing to a log file in the Application_EndRequest() function of the Global.asax file.

I want to include the content length in this logging, but when I try to access the Response.Headers["content-length"] value there is no header there. There is one when I check the networking tab on the developer tools:

Developer Tools - Networking tab

From what I've researched I think this means that the header isn't available at the time the Application_EndRequest() function of the Global.asax file is called. Is there any other way I can surmise the content length in this function?

Any help would be greatly appreciated, thanks!

0

There are 0 answers