Using MiniProfiler in a UI-less mode


#1

MiniProfiler can profile your requests without displaying the results to the end user.

This is achieved by profiling server side using the same old:

MiniProfiler.Start();

and

MiniProfiler.Stop(); 

And rendering the UI block

@using StackExchange.Profiling;
<head>
 ..
</head>
<body>
  ...
  @MiniProfiler.RenderIncludes()
</body>

To disallow the UI from displaying ensure :

MiniProfiler.Settings.Results_Authorize = (request) =>
{
      // when you return false the user will not have access to the UI
      return Current.User.IsAdmin; 
};