/umbraco/surface/MyUmbReset/test/ <- this works fine
/umbraco/surface/MyUmbReset/testpost <- returns a 404
/umbraco/surface/MyUmbReset/testpostid/1 <- returns a 404
using System.Web.Mvc;
using umbraco.cms.businesslogic.member;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;
using Umbraco.Core;
using System;
using umbraco;
using Umbraco.Core.Services;
using Umbraco.Core.Security;
using System.Web;
namespace Surfacecontrollers
{
public class MyUmbResetController : SurfaceController
{
[HttpGet]
public ActionResult test()
{
return Content("Hi there!");
}
[HttpPost]
public ActionResult testpost()
{
return Content("posted");
} public ActionResult testpostid(string id)
{
return Content(id);
}
I've just cut and paste the code you have above into a surface controller in an Umbraco site on my machine, and all appears to work ok!; but how are you 'posting' to the testpost endpoint ?
in the view to generate the form, that posts to your 'testpost' endpoint.
If you use a straightforward form tag or use Html.BeginForm, then I think the post request will be missing the hidden 'ufprt' value that Umbraco routing looks for in Surface Controller posts:
SurfaceController 404 on post but not on get
Please advise
/umbraco/surface/MyUmbReset/test/ <- this works fine /umbraco/surface/MyUmbReset/testpost <- returns a 404 /umbraco/surface/MyUmbReset/testpostid/1 <- returns a 404
Hi Anton
I've just cut and paste the code you have above into a surface controller in an Umbraco site on my machine, and all appears to work ok!; but how are you 'posting' to the testpost endpoint ?
Are you using BeginUmbracoForm ?
eg in my test version of your code I have:
in the view to generate the form, that posts to your 'testpost' endpoint.
If you use a straightforward form tag or use Html.BeginForm, then I think the post request will be missing the hidden 'ufprt' value that Umbraco routing looks for in Surface Controller posts:
which is a hash of the routing values.
is working on a reply...