internal static void RegisterRoutes()
        {
            var urls = new[]
            {
                "netbash",
                "netbash-jquery-js",
                "netbash-keymaster-js",
                "netbash-style-css",
                "netbash-script-js"
            };

            var routes = RouteTable.Routes;
            var handler = new NetBashHandler();
            var prefix = ensureTrailingSlash((NetBash.Settings.RouteBasePath ?? "").Replace("~/", ""));

            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 = "NetBashHandler", action = "ProcessRequest" })
                    };

                    // put our routes at the beginning, like a boss
                    routes.Insert(0, route);
                }
            }
        }
Exemple #2
0
        internal static void RegisterRoutes()
        {
            var urls = new[]
            {
                "netbash",
                "netbash-jquery-js",
                "netbash-keymaster-js",
                "netbash-style-css",
                "netbash-script-js"
            };

            var routes  = RouteTable.Routes;
            var handler = new NetBashHandler();
            var prefix  = ensureTrailingSlash((NetBash.Settings.RouteBasePath ?? "").Replace("~/", ""));

            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 = "NetBashHandler", action = "ProcessRequest" })
                    };

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