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
Hi,
I am trying to use a UmbracoPageController to route something that is not in Umbraco and it works as expected.
UmbracoPageController
However, I noticed that SurfaceController no longer submits to the method.
SurfaceController
The surface controller works if rendered via a RenderController and the routing is setup as I can get to the page.
RenderController
public class ProductPageController : UmbracoPageController, IVirtualPageController { private readonly IUmbracoContextAccessor _umbracoContextAccessor; public ProductPageController(ILogger<UmbracoPageController> logger, ICompositeViewEngine compositeViewEngine, IUmbracoContextAccessor umbracoContextAccessor) : base(logger, compositeViewEngine) { _umbracoContextAccessor = umbracoContextAccessor; } public async Task<ActionResult<ProductPageViewModel>> Details(string id) { var vm = new ProductPageViewModel(id); return View("ProductDetailsPage", vm); } public IPublishedContent FindContent(ActionExecutingContext actionExecutingContext) { var root = _umbracoContextAccessor.GetRequiredUmbracoContext().Content.GetAtRoot().FirstOrDefault(); return root; } }
And
public class ProductController : SurfaceController { public ProductController(IUmbracoContextAccessor umbracoContextAccessor, IUmbracoDatabaseFactory databaseFactory, ServiceContext services, AppCaches appCaches, IProfilingLogger profilingLogger, IPublishedUrlProvider publishedUrlProvider) : base(umbracoContextAccessor, databaseFactory, services, appCaches, profilingLogger, publishedUrlProvider) { } [HttpPost] [ValidateAntiForgeryToken] [ValidateUmbracoFormRouteString] public IActionResult HandleAdd(ProductForm model) { // code goes here } }
Does anyone know what's missing or surface controller don't work in that context?
Thanks,
Paulius
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
SurfaceController in custom router UmbracoPageController
Hi,
I am trying to use a
UmbracoPageController
to route something that is not in Umbraco and it works as expected.However, I noticed that
SurfaceController
no longer submits to the method.The surface controller works if rendered via a
RenderController
and the routing is setup as I can get to the page.And
Does anyone know what's missing or surface controller don't work in that context?
Thanks,
Paulius
is working on a reply...