This project is read-only.

Best way to disable specific routes?

Topics: Core, Customizing Orchard, General, Writing modules
Feb 9, 2012 at 3:09 PM

I want to disable some module routes, for example public "Profile" ones from the Profile module. What's the best way to do this? Is there a way to delete the routes from the route table, and if so where do I hook in to accomplish it? 

One way I can think of is to declare all the routes I want to disable inside my own IRouteProvider with a higher priority, pointing them towards a controller action that returns a 404. I'm not sure if there's a better method though. If the routes could just be deleted that would be preferable. 

Feb 9, 2012 at 3:43 PM


Feb 9, 2012 at 4:22 PM

Is that attribute suitable even if I don't want to replace existing functionality? I would rather just delete the unwanted routes if at all possible. 



Feb 9, 2012 at 4:54 PM

No, routes have priorities in Orchard, so you can replace a route by adding your own with a higher priority.

Feb 10, 2012 at 6:24 AM

Well, you can use OrchardSuppressDependency to disable IRouteProviders entirely if you just want to switch routes off.