2

I have the MiniProfiler installed in my ASP.NET MVC 3 project running good but i got a problem, the MiniProfiler only shows logs from the last request and some "summary" of the whole site loading.

I have a form that posts to /MyForm and MyForm actionresult redirects to /Show and i get all logs for /Show but not all from /MyForm but i getting a summary how long time the /MyForm taked + the sql questions but i dont get the children logs from it.

Any ideas?

RickardP
  • 2,558
  • 7
  • 34
  • 42

2 Answers2

3

I found the similar issue of not showing the profiler-popup button in page, of a POST request after redirect. In my case, it was because of the result length exceeds the maximum Json string Length. To resolve this I set the size limit as below:

MiniProfiler.Settings.MaxJsonResponseSize = int.MaxValue

I put it in Application_Start().

Kibria
  • 1,865
  • 1
  • 15
  • 17
0

I found the response:

In the global.asax, after the call to MiniProfiler.Stop(), add this code to prevent to tell the id of the logs at the ajax response.

        //Se faccio il redirect tolgo il render del mini profiler
        const string KEY_HEADER_MINIPROFILER = "X-MiniProfiler-Ids";
        if (!string.IsNullOrEmpty(Response.RedirectLocation) && Response.Headers.AllKeys.Contains(KEY_HEADER_MINIPROFILER))
        {
            Response.Headers.Remove(KEY_HEADER_MINIPROFILER);
        }

In the next page will be rendered also the log of the page that make the redirect

If you make itself the redirect with a javascript after an ajax request remember to make:

Response.RedirectLocation = "...."