MVC Widget retuning 404 on View Change
Hello,
I've been developing an MVC widget which will be used to test some third-party integration functionality.
However, I'm having a lot of trouble making the returned view be recognized.
So, I have my Controller with the following code:
01.public class PayExTesterController : Controller02.03. /// <summary>04. /// This is the default Action.05. /// </summary>06. public ActionResult Index()07. 08. var model = new PayExTesterModel();09. 10. return View("Default", model);11. 12. 13. public ActionResult Redirect()14. 15. var model = new PayExTesterModel();16. return View("Redirect", model);17. 18.
Also, my Default view all it does is have a button to call the Redirect method:
1.<div>2. @using(Html.BeginFormSitefinity("Redirect", "PayExTester"))3. 4. <input type="submit" value="Go" />5. 6.</div>, which will then call the Redirect View:
1.@model SitefinityWebApp.Mvc.Models.PayExTesterModel2.@using Telerik.Sitefinity.UI.MVC;3.@using Telerik.Sitefinity.Frontend.Mvc.Helpers4. 5.<h1>6. Success!!7.</h1>However, whenever I click go, i get an 404 error. What am I doing wrong or what is wrong with my code?
If I call from the Redirect View from within the Index method, everything works as expected (I get the Redirect view) bot not when that happens as a result of a call/action.
Best Regards,
Celso Santos
So, basically, the problem was that I was missing an [HttpPost] notation on the Redirect method