+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / PageEditorRouteHandler not working

PageEditorRouteHandler not working

13 posts, 2 answered
  1. Clinton
    Clinton avatar
    14 posts
    Registered:
    27 Feb 2014
    29 Dec 2015
    Link to this post

    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

     

  2. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    29 Sep 2016
    31 Dec 2015
    Link to this post
    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
     
  3. Clinton
    Clinton avatar
    14 posts
    Registered:
    27 Feb 2014
    31 Dec 2015
    Link to this post

    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

  4. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    29 Sep 2016
    31 Dec 2015
    Link to this post
    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
     
  5. Clinton
    Clinton avatar
    14 posts
    Registered:
    27 Feb 2014
    08 Feb in reply to Nikola Zagorchev
    Link to this post

    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

  6. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    29 Sep 2016
    18 Feb
    Link to this post
    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
     
  7. Clinton
    Clinton avatar
    14 posts
    Registered:
    27 Feb 2014
    23 Feb in reply to Nikola Zagorchev
    Link to this post

    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.

  8. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    29 Sep 2016
    26 Feb
    Link to this post
    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
     
    Answered
  9. Clinton
    Clinton avatar
    14 posts
    Registered:
    27 Feb 2014
    29 Feb in reply to Nikola Zagorchev
    Link to this post

    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

    Answered
  10. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    29 Sep 2016
    29 Feb
    Link to this post
    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
     
  11. Clinton
    Clinton avatar
    14 posts
    Registered:
    27 Feb 2014
    11 Mar in reply to Nikola Zagorchev
    Link to this post

    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

  12. Nikola Zagorchev
    Nikola Zagorchev avatar
    424 posts
    Registered:
    29 Sep 2016
    22 Mar
    Link to this post
    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
     
  13. Clinton
    Clinton avatar
    14 posts
    Registered:
    27 Feb 2014
    28 Mar in reply to Nikola Zagorchev
    Link to this post

    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

13 posts, 2 answered