Removing the MiniProfiler routes if solution is not in debug mode.
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Web;
|
||||
using System.Web.Routing;
|
||||
using StackExchange.Profiling;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Web.Profiling
|
||||
{
|
||||
@@ -24,6 +27,19 @@ namespace Umbraco.Web.Profiling
|
||||
{
|
||||
// booting...
|
||||
_bootPhase = BootPhase.Boot;
|
||||
|
||||
// Remove Mini Profiler routes when not in debug mode
|
||||
if (GlobalSettings.DebugMode == false)
|
||||
{
|
||||
var prefix = MiniProfiler.Settings.RouteBasePath.Replace("~/", string.Empty);
|
||||
|
||||
using (RouteTable.Routes.GetWriteLock())
|
||||
{
|
||||
var routes = RouteTable.Routes.Where(x => x is Route r && r.Url.StartsWith(prefix)).ToList();
|
||||
foreach(var r in routes)
|
||||
RouteTable.Routes.Remove(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -118,4 +134,4 @@ namespace Umbraco.Web.Profiling
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user