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 },
);
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();
}
}
DataTokens must contain an 'umbraco-doc-request' key with a PublishedContentRequest object
Site is throwing
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
Route config
View
@Html.Action("MyAction", "MyController")
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
Hi Jan
Had a read through that post earlier, didn't really help. I'm on 7.2, for what it's worth.
I'm getting the same error meesgae here running on 7.4.3.
For anyone interested while reading this post, I use the following, with regards to the naming used in the original question
Routeconfig.cs
MyController.cs
is working on a reply...