asp.net-mvctelerik-mvcsitefinity-8

Return View throwing 404


I've been working with Telerik's Sitefinity CMS and I've been working on a widget which will integrate with a third-party payment system.

One of the first tests I did to see if everything was going fine was to implement a View (Default.cshtml) with a Button that calls my Redirect action, which returs a different View (Redirect.cshtml).

Here's my Default view:

@model SitefinityWebApp.Mvc.Models.PayTesterModel
@using Telerik.Sitefinity.UI.MVC;
@using Telerik.Sitefinity.Frontend.Mvc.Helpers

<div>
    @using(Html.BeginFormSitefinity("Redirect", "PayTester"))
    {
        <input type="submit" value="Go" />
    }
</div>

With this, here's my Controller:

using System;
using System.ComponentModel;
using System.Linq;
using System.Web.Mvc;
using Telerik.Sitefinity.Mvc;
using SitefinityWebApp.Mvc.Models;

namespace SitefinityWebApp.Mvc.Controllers
{
    [ControllerToolboxItem(Name = "PayTester", Title = "PayTester", SectionName = "MvcWidgets"), Telerik.Sitefinity.Web.UI.ControlDesign.ControlDesigner(typeof(SitefinityWebApp.WidgetDesigners.PayTester.PayTesterDesigner))]
    public class PayTesterController : Controller
    {
        /// <summary>
        /// This is the default Action.
        /// </summary>
        public ActionResult Index()
        {
            var model = new PayTesterModel();
            return View("Default", model);
        }

        public ActionResult Redirect()
        {
            return View("Redirect");
        }
    }
}

And finally my Redirect View:

@using Telerik.Sitefinity.UI.MVC;
@using Telerik.Sitefinity.Frontend.Mvc.Helpers

<h1>
    Success!!
</h1>

Whenever the action is called, I'll get a 404 error and I've tried different methods of achieving the same intended result but I always get the same 404.

What am I doing wrong here?


Solution

  • As JamieD77 correctly pointed out, the action is missing the [HttpPost] attribute.