PageEditorRouteHandler not working

Posted by Community Admin on 04-Aug-2018 14:55

PageEditorRouteHandler not working

All Replies

Posted by Community Admin on 29-Dec-2015 00:00

Hello,

I have been using the PageEditorRouteHandler to execute custom code on my Page designers and this has been working flawlessly until I installed Sitefinity Feather to get the new MVC widgets. Ever since then the handler has not been executing at all.

I have noticed the new class "MvcPageEditorRouteHandler" which I also tried to capture the route for but this is also not executing.

My code:

ObjectFactory.Container.RegisterType<PageEditorRouteHandler, CustomPageEditorRouteHandler>();

ObjectFactory.Container.RegisterType<MvcPageEditorRouteHandler, CustomMvcPageEditorRouteHandler>();

Any help to get this back up and running like it was before Feather was installed would be greatly appreciated.

Regards,
Clinton

 

Posted by Community Admin on 31-Dec-2015 00:00

Hi Clinton,

Where in the Global Application class you are registering the custom route handler? Is it on Bootstrapper_Bootstrapped?
You can check the following KB for overriding MVC route handlers:
http://www.sitefinity.com/developer-network/knowledge-base/details/how-to-replace-the-mvcpageroutehandler

Regards,
Nikola Zagorchev
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 31-Dec-2015 00:00

Hello Nikola,

We have been registering our routes in the "Bootstrapper.Initialized" event when the command name is "RegisterRoutes". This has worked fine for us and the past and has only stopped working after Feather.

I just tried registering my routes in the Bootstrapper_Bootstrapped event and they still aren't firing.

Thanks,
Clinton

Posted by Community Admin on 31-Dec-2015 00:00

Hello,

Using the following, it is working correctly on my end:

protected void Application_Start(object sender, EventArgs e)
        
            Bootstrapper.Bootstrapped += Bootstrapper_Bootstrapped;         
        
 
        protected void Bootstrapper_Bootstrapped(object sender, EventArgs e)
        
            ObjectFactory.Container.RegisterType<PageEditorRouteHandler, PageEditorRouteHandlerCustom>();
        

internal class PageEditorRouteHandlerCustom : MvcPageEditorRouteHandler


Regards,
Nikola Zagorchev
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 08-Feb-2016 00:00

Hello Nikola,

The code snippet does work, but only once. If I refresh the page or go to a different designer, the ApplyLayoutsAndControls method is no longer executed.

Any advice?

Thanks,
Clinton

Posted by Community Admin on 18-Feb-2016 00:00

Hi Clinton,

On my end the ApplyLayoutsAndControls method is called only once when the page is opened for edit. This behavior is the same on a project without Feather.
What is the behavior expected and how it was used before?

Regards,
Nikola Zagorchev
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 23-Feb-2016 00:00

Before we were using the PageEditorRouteHandler and it was working fine and executing 100% of the time you open a page for editing.

Since Sitefinity 8.2 we have added another handler for Mvc designers, the "MvcPageEditorRouteHandler" and this has never been executing consistently. I just recently ran a test and deactivated the "Feather" module and the PageEditorRouteHandler is now executing again 100% of the time. Activating it and going back to the same page designer prevents BOTH the PageEditorRouteHandler and MvcPageEditorRouteHandler from executing the ApplyLayoutsAndControls function.

It is unfortunate that you cannot reproduce it because we see clear results here when activating and deactivating the Feather module with both editor handlers registered.

Posted by Community Admin on 26-Feb-2016 00:00

Hi Clinton,

Here is the code I am using:

protected void Application_Start(object sender, EventArgs e)
        
            Bootstrapper.Bootstrapped += Bootstrapper_Bootstrapped;
        
 
protected void Bootstrapper_Bootstrapped(object sender, EventArgs e)
        
            ObjectFactory.Container.RegisterType<PageEditorRouteHandler, PageEditorRouteHandlerCustom>();
        
internal class PageEditorRouteHandlerCustom : MvcPageEditorRouteHandler
    
        protected override void ApplyLayoutsAndControls(System.Web.UI.Page page, System.Web.Routing.RequestContext requestContext)
        
            base.ApplyLayoutsAndControls(page, requestContext);
        

I have also attached a video showing the functionality on my end.

Regards,
Nikola Zagorchev
Telerik
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 29-Feb-2016 00:00

Hello Nikola,

Thanks for the response and the video, with these items I was able to figure out what the problem was:

In previous Sitefinity versions from Sitefinity 7.2 to Sitefinity 8.2 (pre-feather) utilizing the Bootstrapper.Initialized event with a check for the "Bootstrapped" event args is working to register the PageEditorRouteHandler.

However in Sitefinity 8.2 with feather, this method of attaching the RouteHandlers no longer works and we are required to switch where we register the type with the object factory to the Bootstrapper.Bootstrapped event. Switching to this event and registering the routes works as intended.

This may be an issue with some certain feather initializations preventing these routes from being registered. It is definitely a forwards-compatibility issue.

Thanks for your time in helping debug this.

Regards,
Clinton

Posted by Community Admin on 29-Feb-2016 00:00

Hi Clinton,

Thank you for letting us know what the issue was. I am glad you have managed to resolve it on your end.

Regards,
Nikola Zagorchev
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 11-Mar-2016 00:00

Hello Nikola,

I am trying to do similar things on the MVC template editor, however the MvcTemplateEditorRouteHandler class privacy is set to "internal". I tried using the TemplateEditorRouteHandler on for MVC templates but it crashes with an object reference exception. Can we please get the MvcTemplateEditorRouteHandler set to "public" before Sitefinity 9.0 ?

Cheers,
Clinton

Posted by Community Admin on 22-Mar-2016 00:00

Hi Clinton,

Cloud you please let me know what you are trying to achieve by overriding the MvcTemplateEditorRouteHandler?
This way we can propose a different approach or log a feature request for the class being public with that reasoning.

Regards,
Nikola Zagorchev
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 28-Mar-2016 00:00

Hello Nikola,

We are using these RouteHandlers on the designers to programatically inject CSS to each designer page to allow for customization of widget icons. Until Sitefinity provides us a way of changing icons without CSS, this is what we are forced to do for all of our clients and their diverse Sitefinity sites.

Let me know what you can do.

Regards,
Clinton

Posted by Community Admin on 05-Dec-2016 00:00

I'm sure more than a few developers have wasted a lot of time on this, because it's not in the documentation. When will this be updated in the docs??

 

docs.sitefinity.com/tutorial-use-an-item-parameter-to-implement-role-based-toolbox-filtering

 

Posted by Community Admin on 21-Nov-2017 00:00

Hello Clinton and Nikola.

We are trying to achieve the same but also notice feather class MvcTemplateEditorRouteHandler is internal, we just want to inject our custom css for widget images, using method ApplyLayoutsAndControls. We also notice that similar class MvcPageEditorRouteHandler is Public, we don't understand why feather team wants to keep MvcTemplateEditorRouteHandler internal.

Did you manage to inject widgets custom css, during template editing ?


Posted by Community Admin on 21-Nov-2017 00:00

Hi Ronnie,

As of Sitefinity 10.1.6503 the MvcTemplateEditorRouteHandler is still built as internal. We have found no workaround for this issue at the moment and have accepted the fact that we cannot customise widget icons in the template editor.

I may go ahead and log this as an issue in the feedback portal to get this addressed for the next release.

Regards,
Clinton

Posted by Community Admin on 21-Nov-2017 00:00

 

Thanks for your response. 

Please let me know once you track the request in the feedback portal so I can support it.

Regards

Posted by Community Admin on 22-Dec-2017 00:00

Hi Ronnie,

Sitefinity has made my issue public. You can vote for making the MvcTemplateEditorRouteHandler public here:

https://feedback.telerik.com/Project/153/Feedback/Details/232191-mvctemplateeditorroutehandler-marked-as-internal

This thread is closed