Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Gary Cheetham 20 posts 144 karma points
    Aug 25, 2016 @ 10:04
    Gary Cheetham
    0

    RESOLVED: Global Find/Replaced default namespace, now Umbraco cannot resolve routes to my controllers (route hijacking broken)

    Hi,

    I have a FeedbackPageController which handles requests to any page with the FeedbackPage document type via route hijacking.

    namespace MySite.Controllers
    {
        public class FeedbackPageController : RenderMvcController
        {
            private IReviewsService reviewsService = DependencyResolver.Current.GetService<IReviewsService>();
    
            public async Task<ActionResult> FeedbackPage(RenderModel model)
            {
                var viewModel = new FeedbackPageViewModel(model.Content);
                viewModel.Reviews = await reviewsService.GetReviews();
                return CurrentTemplate(viewModel);
            }
        }
    }
    

    Let's say that my site's original default namespace was "MySite.co.uk". I changed this to "MySite" by doing a global find and replace and updating my .csproj file with the new namespace.

    Now, when I navigate to /feedback, I'm getting this YSOD:

    Yellow screen of death

    It's like Umbraco can't resolve the route to my controller any more.

    Before you ask, there is no MySite.co.uk.Controllers.FeedbackPageController in my solution, I only have a MySite.Controllers.FeedbackPageController.

    I don't know how there can still be an ambiguous reference, when there is only one of these controllers present in the solution.

    Any tips to get "route hijacking" working properly again?

    UPDATE: I renamed the FeedbackPageController back to MySite.co.uk.Controllers.FeedbackPageController and now I get this YSOD:

    Second Yellow Screen of Death

    It really is like there are two controllers.

    What is going on here?

  • David Peck 690 posts 1896 karma points c-trib
    Aug 25, 2016 @ 10:17
    David Peck
    100

    Do you still have the old DLL in the bin folder? So MySite.dll and MySite.co.uk.dll?

  • Gary Cheetham 20 posts 144 karma points
    Aug 25, 2016 @ 10:21
    Gary Cheetham
    0

    Yep, that was it David. The old DLL was still present in the bin folder.

Please Sign in or register to post replies

Write your reply to:

Draft