Custom routes for custom non content pages break backoffice.
When i add custom mvc or http routes to RouteTable - halph of backoffice start using /{myroute}/ for api, so it just produces 404 and simply not working.
My code:
[ComposeBefore(typeof(ServicesComposer))]
public class UserComposer : IUserComposer
{
public void Compose(Composition composition)
{
composition.Components().Append<RouteComponent>();
composition.Components().Append<BundleComponent>();
}
}
public class RouteComponent : IComponent
{
public void Initialize()
{
RouteConfig.Register(RouteTable.Routes);
//GlobalConfiguration.Configure(WebApiConfig.Register);
}
public void Terminate()
{
//throw new NotImplementedException();
}
}
public static class RouteConfig
{
public static void Register(RouteCollection routes)
{
//routes.MapControllerAttributeRoutes()
routes.MapRoute(
name: "Default",
url: "mvc/{controller}/{action}/{id}",
namespaces: new string[] { "XX.xxx.Controllers", "XX.xxx.Hijacking.Controllers" },
defaults: new
{
Controller = "CustomTour",
action = "Index",
id = UrlParameter.Optional
});
}
}
I have added custom namespaces for routes, but umbraco just start using my route in backoffice and doesnt work anymore.
any idea why it happens and how to solve? I cant use .MapUmbracoRoute as need custom MVC, not based on real content pages.
[ComposeAfter(WebFinalComposer)]
public class RouteComposer : IComposer
{
public void Compose(Composition composition)
{
composition.Components().Append<RouteComponent>();
}
}
or
[ComposeAfter(typeof(WebFinalComposer))]
public class RouteComposer: ComponentComposer<RouteComponent>
{
}
where RouteComponent:
public class RouteComponent : IComponent
{
public void Initialize()
{
RouteConfig.Register(RouteTable.Routes);
GlobalConfiguration.Configure(WebApiConfig.Register);
}
public void Terminate()
{
}
}
Custom routes break umbraco backoffice
Custom routes for custom non content pages break backoffice. When i add custom mvc or http routes to RouteTable - halph of backoffice start using /{myroute}/ for api, so it just produces 404 and simply not working. My code:
I have added custom namespaces for routes, but umbraco just start using my route in backoffice and doesnt work anymore.
any idea why it happens and how to solve? I cant use .MapUmbracoRoute as need custom MVC, not based on real content pages.
Link to issue on Umbraco-CMS github: https://github.com/umbraco/Umbraco-CMS/issues/6045
Solution for this issue, got from support team:
or
where RouteComponent:
is working on a reply...