I want to calculate the execution time of my ASP.NET pages and display it on the page. Currently I'm calculating the execution time using a System.Diagnostics.Stopwatch and then store the value in a log database.
The stopwatch is started in OnInit and stopped in OnPreRenderComplete. This seems to be working quite fine, and it's giving a similar execution time as the one shown in the page trace.
The problem now is that I'm not able to display the execution time on the page because the stopwatch is stopped too late in the life cycle.
What is the best way to do this?