Copied to clipboard

Flag this post as spam?

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

  • Peter Hansen 29 posts 72 karma points
    1 week ago
    Peter Hansen

    How to find the RouteTable

    Hi everyone, Back in the days (say Umbraco v7 I think), I had this partial view to include to help me debug stuff. It was pretty simple and it just showed all possible routes

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
        var routes = RouteTable.Routes;
        foreach (var route in routes)
            var r = (System.Web.Routing.Route)route;
            string divider = "Api";
            if (r.Url.ToString().Contains(divider))
                string newR = r.Url.ToString();
                string collected = newR.Replace(divider, "<span style='color:white; background-color:Fuchsia;'>" + divider + "</span>");

    Now, trying to make a site in Umbraco v12 I ended up in the very same situation where I needed this partial view. But it doesn't work anymore. I tried Google Fu for a couple of hours but couldn't find anything. My main problem is where to find RouteTable.Routes. I know that it is in the System.Web.Routing but that isn't a part of my installation I guess (I use the Umbraco Project Template for VS2022 to debug and deploy).


Please Sign in or register to post replies

Write your reply to: