Copied to clipboard

Flag this post as spam?

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


  • Nathan Woulfe 447 posts 1664 karma points MVP 5x hq c-trib
    Mar 31, 2015 @ 04:37
    Nathan Woulfe
    1

    DataTokens must contain an 'umbraco-doc-request' key with a PublishedContentRequest object

    Site is throwing

    DataTokens must contain an 'umbraco-doc-request' key with a
    PublishedContentRequest object
    

    within a RenderMvcController, can anyone explain what that actually means, and how I might go about correcting it?

    I figured the routing is working as the action is being hit, but it falls over as soon as it hits a reference to CurrentPage. I'm guessing I could pass the value into the action, but that won't help when I have multiple values required in the action.

    Controller

    public class MyController : RenderMvcController
    {
        [MyActionFilter]
        public override ActionResult Index(RenderModel model)
        {
            return base.Index(model);
        }
    
        [ChildActionOnly]
        public ActionResult MyAction()
        {
            ...
            var q= String.Format("nodeId:{0}", CurrentPage.Id); // throws error here
            ...
        }
    }
    

    Route config

    routes.MapRoute(
        "MyController",
        "MyController/{action}/{id}",
        new { action = UrlParameter.Optional, id = UrlParameter.Optional },
    );
    

    View

    @Html.Action("MyAction", "MyController")

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Mar 31, 2015 @ 05:15
    Jan Skovgaard
    0

    Hi Nathan

    Don't know if the second post here can help? https://our.umbraco.org/forum/ourumb-dev-forum/bugs/44643-umbraco-route-def-missing-from-RouteDataDataTokens - It's from 2013 though...But what version of Umbraco are you seeing this on?

    /Jan

  • Nathan Woulfe 447 posts 1664 karma points MVP 5x hq c-trib
    Mar 31, 2015 @ 05:41
    Nathan Woulfe
    0

    Hi Jan

    Had a read through that post earlier, didn't really help. I'm on 7.2, for what it's worth.

  • Richard Browne 2 posts 72 karma points
    Jun 08, 2016 @ 18:08
    Richard Browne
    0

    I'm getting the same error meesgae here running on 7.4.3.on this line

  • Tom 34 posts 154 karma points
    Jan 02, 2017 @ 20:36
    Tom
    0

    For anyone interested while reading this post, I use the following, with regards to the naming used in the original question

    Routeconfig.cs

    routes.MapRoute(
         name: "MyRoute", //could be anything
         url: "my/{action}/{id}",
         defaults: new { controller = "MyController", action = "Index", id = UrlParameter.Optional 
    });
    

    MyController.cs

    public class MyController : SurfaceController {
         public ActionResult Index () {
             return new EmptyResult();
         }
    
        public ActionResult MyAction() {
             var q= String.Format("nodeId:{0}", CurrentPage.Id);
             return new EmptyResult();
         }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft