-
-
Save nul800sebastiaan/0aa1fc02911604bf11eeb4a5c15b7d51 to your computer and use it in GitHub Desktop.
| using System.Web.Routing; | |
| using Umbraco.Core.Composing; | |
| using Umbraco.Web.Runtime; | |
| namespace RemoveRoutes | |
| { | |
| // This is required to ensure this composer runs after | |
| // Umbraco's WebFinalComposer which is the component | |
| // that creates all of the routes during startup | |
| [ComposeAfter(typeof(WebFinalComposer))] | |
| public class RemoveRoutesComposer : ComponentComposer<RemoveRoutesComponent> | |
| { | |
| } | |
| //The component that runs after WebFinalComponent | |
| //during startup to modify the routes | |
| public class RemoveRoutesComponent : IComponent | |
| { | |
| public void Initialize() | |
| { | |
| // Reference: https://github.com/umbraco/Umbraco-CMS/issues/5206 | |
| // Reference: https://shazwazza.com/post/need-to-remove-an-auto-routed-controller-in-umbraco/ | |
| // Note: RouteTable needs System.Web.dll | |
| RouteTable.Routes.Remove(RouteTable.Routes["umbraco-surface-UmbRegister"]); | |
| RouteTable.Routes.Remove(RouteTable.Routes["umbraco-surface-UmbProfile"]); | |
| RouteTable.Routes.Remove(RouteTable.Routes["umbraco-surface-UmbLogin"]); | |
| RouteTable.Routes.Remove(RouteTable.Routes["umbraco-surface-UmbLoginStatus"]); | |
| RouteTable.Routes.Remove(RouteTable.Routes["umbraco-api-Tags"]); | |
| } | |
| public void Terminate() | |
| { | |
| } | |
| } | |
| } |
Note: As per the comment here, the Tags route was just updated to be umbraco-api-Tags: https://gist.github.com/nul800sebastiaan/927dcf155439fcc867e97a4d8dda6e16#gistcomment-2984807
Hi,
When i add the fix to sites running 8.0.0 i get the following error:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'WebFinalComposer' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 8: // Umbraco's WebFinalComposer which is the component
Line 9: // that creates all of the routes during startup
Line 10: [ComposeAfter(typeof(WebFinalComposer))]
Line 11: public class RemoveRoutesComposer : ComponentComposer
Line 12: {
It OK in later versions.
Any ideas?
Cheers,
Mark
Please note that we have just updated this code and posted a new security advisory.