This still seems to be an issue but I think I found a workaround: instead of returning CurrentUmbracoPage() return Redirect(Request.UrlReferrer.ToString()). That seems to be working
The above will lose ModelState, and incidentally can be simplified using return RedirectToCurrentUmbracoPage().
What you can do though is a good old fashioned MVC return View("viewName", yourContentModel), keeping in mind that CurrentPage represents the IPublishedContent of the current page.
RenderMvcController async ActionResult vs Surfacecontroller CurrentUmbracoPage
Hi all,
I'm struggling to get the SurfaceController CurrentUmbracoPage actionresult to work with async actions on my RenderMvcController.
Basically, i've created a custom controller, hijacking the Umbraco Routes:
I also have a form post on my homepage which posts to a SurfaceController:
return CurrentUmbracoPage() causes a ysod: The asynchronous action method 'Home' returns a Task, which cannot be executed synchronously.
Can anybody explain what I am missing here?
Hi Davy
I think it's not possible to do.
You can wrap async operations in sync, but I think it's not possible to make SurfaceController or RenderMvcController to return Task.
Thanks,
Alex
Hi Alex,
thanks for the reply. I'm really sure it's possible to work with async Tasks in a SurfaceController or RenderMvcController.
It is the combination with CurrentUmbracoPage() that is causing the problem.
Yes, I think so too. Will edit an answer.
This still seems to be an issue but I think I found a workaround: instead of returning
CurrentUmbracoPage()
returnRedirect(Request.UrlReferrer.ToString())
. That seems to be workingThe above will lose ModelState, and incidentally can be simplified using
return RedirectToCurrentUmbracoPage()
.What you can do though is a good old fashioned MVC
return View("viewName", yourContentModel)
, keeping in mind thatCurrentPage
represents the IPublishedContent of the current page.is working on a reply...