MvcSiteMapProvider Sitemap.xml endpoint breaks with custom route

118 Views Asked by At

I have a custom route to simplify the url and only use the home controller implicitly, but by doing so I can no longer access my sitemap.xml form the default endpoint, how could I fix this?

'routes.MapRoute(
'    name:="OmitController",
'    url:="{action}/{id}",
'    defaults:=New With {.controller = "Home", .action = "Index", .id = UrlParameter.Optional}
')
1

There are 1 best solutions below

0
rojobo On

Nevermidn I looked at the source code and saw that the default route for the sitemap.xml is calling the XmlSiteMap and the Index action so I added this

    routes.MapRoute(
            "sitemap",
            "sitemap.xml",
            New With {.controller = "XmlSiteMap", .action = "Index"}
        )

and it works now