If you added MiniProfiler via the MiniProfiler.MVC3 package, then it adds a C# file for your convenience in configuring it: look in App_Start\MiniProfiler.cs
, looking in particular at Init
which has the code to decide whether to start profiling (request.IsLocal
is the default)
In your case, I would suggest checking for a cookie in the start condition, and checking your more complete "am I a developer, or just someone who heard about a special cookie" in the end condition; in particular, if you call MiniProfiler.Stop(false)
, then all the data is discarded. Your "turn it on in a secret way" and "pre defined time" are then all achieved cheaply via the cookie, with the "am I a developer" there to make sure that it can't be abused just by setting a cookie.