Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Squazz 35 posts 111 karma points
    Apr 12, 2016 @ 09:20
    Squazz
    0

    Working with the miniprofiler

    This is a two part question, which circles around the same problematcis.

    Without setting anything up in Global.Asax, and just inserting this line in my .cshtml file for my basic layout, and running my site in debug mode, the MiniProfiler is automatically displayed in my frontend.

    @MiniProfiler.RenderIncludes()
    

    Trying to shut down the MiniProfiler doesn't seem to work. I have tried something as obvious as the following code, but the MiniProfiler is still run, and is still represented in my frontend, when running my site locally:

    protected void Application_BeginRequest()
    {
        MiniProfiler.Stop();
        if (!Request.IsLocal)
        {
            MiniProfiler.Start();
        }
    }
    

    Furthermore In Umbraco.Core's WebProfiler I found the following code:

    if (GlobalSettings.DebugMode == false) 
        return false;
    

    In my case, i would like to be able to let the Profiler run on my clients site, but that's not possible as DebugMode is always false when I publish my code to my clients site.

    Ideally I would like to do something like:

    protected void Application_BeginRequest()
    {
        MiniProfiler.Stop();
        if (Request.IsLocal || Request.UserHostAddress == "My/developers IP")
        {
            MiniProfiler.Start();
        }
    }
    

    How can I programmatically stop the MiniProfiler to set up cases where I don't want it to run when in DebugMode? And how can I make the MiniProfiler available for developers on my customers live sites?

    EDIT:

    Also asked on SO to increase exposure: http://stackoverflow.com/questions/36569804/disabling-and-enabling-miniprofiler-when-working-with-umbraco-7

Please Sign in or register to post replies

Write your reply to:

Draft