We have moved to GitHub Issues
Created by Jeroen Breuer 24 Jan 2013, 11:33:12 Updated by Sebastiaan Janssen 04 Apr 2013, 14:16:09
Relates to: U4-1536
Relates to: U4-1599
I'm calling a SurfaceController from a view with Html.Action, but when I try to use the CurrentPage property I get the following exception:
Can only use UmbracoPageResult in the context of an Http POST when using the BeginUmbracoForm helper.
However the following does work to get the current page: UmbracoHelper.TypedContent(System.Web.HttpContext.Current.Items["pageID"]);
Another workaround is to get the page from the UmbracoHelper (U4-1527), but it would be nice if this property would also work.
I had this issue. You can also pass CurrentPage into the action.
Had a quick look at the SurfaceController in the source. Currently this code is used to return the CurrentPage:
var routeDef = (RouteDefinition)ControllerContext.RouteData.DataTokens["umbraco-route-def"]; return routeDef.PublishedContentRequest.PublishedContent; }
I replaced it with the following code in a custom build:
Removing due in 6.1 as this was already implemented in an earlier version, which means it's included in all later versions as well.
Assignee: Shannon Deminick
Backwards Compatible: True
Affected versions: 4.10.0, 4.11.0, 6.0.0, 4.11.1, 4.11.2, 4.11.3
Due in version: 6.0.1, 4.11.5