More in this section
Forums / Bugs & Issues / MVC Widget retuning 404 on View Change

MVC Widget retuning 404 on View Change

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
2 posts, 2 answered
  1. Celso
    Celso avatar
    6 posts
    Registered:
    03 Jul 2015
    31 Aug 2015
    Link to this post

    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 : Controller
    02.{
    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.PayExTesterModel
    2.@using Telerik.Sitefinity.UI.MVC;
    3.@using Telerik.Sitefinity.Frontend.Mvc.Helpers
    4. 
    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

    Answered
  2. Celso
    Celso avatar
    6 posts
    Registered:
    03 Jul 2015
    31 Aug 2015
    Link to this post
    So, basically, the problem was that I was missing an [HttpPost] notation on the Redirect method
    Answered
2 posts, 2 answered