Пример #1
0
        internal static void RegisterRoutes()
        {
            var urls = new[]
            {
                "mini-profiler-jquery.1.6.2.js",
                "mini-profiler-jquery.tmpl.beta1.js",
                "mini-profiler-includes.js",
                "mini-profiler-includes.css",
                "mini-profiler-includes.tmpl",
                "mini-profiler-results"
            };
            var routes  = RouteTable.Routes;
            var handler = new MiniProfilerHandler();
            var prefix  = (MiniProfiler.Settings.RouteBasePath ?? "").Replace("~/", "").EnsureTrailingSlash();

            using (routes.GetWriteLock())
            {
                foreach (var url in urls)
                {
                    var route = new Route(prefix + url, handler)
                    {
                        // we have to specify these, so no MVC route helpers will match, e.g. @Html.ActionLink("Home", "Index", "Home")
                        Defaults = new RouteValueDictionary(new { controller = "MiniProfilerHandler", action = "ProcessRequest" })
                    };

                    // put our routes at the beginning, like a boss
                    routes.Insert(0, route);
                }
            }
        }
        internal static void RegisterRoutes()
        {
            var urls = new[]
            {
                "mini-profiler-jquery.1.6.1.js",
                "mini-profiler-jquery.tmpl.beta1.js",
                "mini-profiler-includes.js",
                "mini-profiler-includes.css",
                "mini-profiler-includes.tmpl",
                "mini-profiler-results"
            };
            var routes = RouteTable.Routes;
            var handler = new MiniProfilerHandler();
            var prefix = (MiniProfiler.Settings.RouteBasePath ?? "").Replace("~/", "").EnsureTrailingSlash();

            using (routes.GetWriteLock())
            {
                foreach (var url in urls)
                {
                    var route = new Route(prefix + url, handler)
                    {
                        // we have to specify these, so no MVC route helpers will match, e.g. @Html.ActionLink("Home", "Index", "Home")
                        Defaults = new RouteValueDictionary(new { controller = "MiniProfilerHandler", action = "ProcessRequest" })
                    };

                    // put our routes at the beginning, like a boss
                    routes.Insert(0, route);
                }
            }
        }