Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
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:
public class HomeController : Umbraco.Web.Mvc.RenderMvcController
public async Task<ActionResult> Home(RenderModel model)
// I've skipped the async stuff
I also have a form post on my homepage which posts to a SurfaceController:
public class LoginController : Umbraco.Web.Mvc.SurfaceController
public async Task<ActionResult> Login(string email, string pw)
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?
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 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() 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.
return View("viewName", yourContentModel)
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted