Copied to clipboard

Flag this post as spam?

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


  • Victor 25 posts 152 karma points
    Sep 07, 2020 @ 07:25
    Victor
    0

    UmbracoVirtualNodeRouteHandler - Post Issue

    Hi guys,

    I'm having an issue with an UmbracoVirtualNodeRouteHandler posting method. I get the following error: enter image description here

    I reckon is due to the lines 64 to 66 from https://github.com/umbraco/Umbraco-CMS/blob/3bfd9b71e290354744d677440983ecd06c5c0788/src/Umbraco.Web/Mvc/UmbracoVirtualNodeRouteHandler.cs

    It calls the FindContent 2 times: enter image description here

    And I dunno why. I have the following routes:

     public void Initialize()
        {
            RouteTable.Routes.MapUmbracoRoute("OrderCheckout", "order-checkout/{id}", new
            {
                controller = "GDOrderCheckout",
                action = "Index"
            }, new GDOrderCheckoutUmbracoVirtualNodeRouteHandler());
        }
    

    This is the controller:

     public ActionResult Index(ContentModel model, int id)
        {
            var productNode = Umbraco.Content(id);
            ViewData["productNode"] = productNode;
            if (productNode != null && productNode.ContentType.Alias.EndsWith("_PriceListPod"))
            {
                return base.Index(model);
            }
    
            return HttpNotFound();
        }
    
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult NextStepInCheckout()
        {
            return View();
        }
    

    Any clues...?

    Thanks!

  • David Armitage 505 posts 2073 karma points
    Sep 07, 2020 @ 09:39
    David Armitage
    0

    Hi Victor,

    The error suggests that you have routes duplicate routes sharing the same key.

    I would probably test renaming OrderCheckout to something else. Maybe this is used elsewhere.

    If you comment out the custom route you added does the error go away. If so maybe do a global search for OrderCheckout and see if you can find where else this is been defined.

    Regards

    David

Please Sign in or register to post replies

Write your reply to:

Draft