Suppressing Contrib.Taxonomies List action from the front-end without altering the module?

Topics: Writing modules
Mar 27, 2013 at 3:19 PM
Edited Mar 27, 2013 at 3:33 PM
I would like to suppress the List action of the Home controller of the Contrib,.Taxonomies module. But I would like to do this without altering the Contrib.Taxonomies module.

I was thinking that I could override this route in another module I have created and return HttpNotFound()
new RouteDescriptor {
                    Priority = 90,
                    Route = new Route(
                            "{taxonomySlug}",
                            new RouteValueDictionary {
                                {"area", "Contrib.Taxonomies"},
                                {"controller", "Home"},
                                {"action", "List"},
                                {"taxonomySlug", ""}
                                                    },
                            new RouteValueDictionary {
                                {"taxonomySlug", _taxonomySlugConstraint}
                                                    },
                            new RouteValueDictionary {
                                {"area", "Contrib.Taxonomies"}
                                                    },
                            new MvcRouteHandler())
                },
But as it uses a route constraint I don't believe it is possible. and to be honest I don't know if this overriding the route is the best way to do it at all.

Any ideas?
Developer
Mar 27, 2013 at 10:17 PM
You can override routes, although I don't know all the details from the top of my head. In any case, you should probably use a higher priority. Adding Orchard.Taxonomnies as a dependency to your module might do the trick in overriding the route.

Alternatively, you could override the List.cshtml file from within your theme or module, and render something else, or even return a 404 from there.