If you haven’t heard, Sitefinity allows for not only ASP.NET WebForms development but also ASP.NET MVC development. There are different modes to MVC development in Sitefinity: Classic, Pure, and Hybrid. I think the most common would be hybrid. If you have an existing site and add a new MVC widget, you’re probably going to use Hybrid.
Code in Hybrid mode is a mix of WebForms in your MasterPages and Razor ASP.NET MVC in your widgets. The routes in Hybrid mode are mixed also. I mean to say that the routes are built for WebForms to work first and MVC second. Because of this you need to pay attention to the ActionName attribute on your control ActionResults and also your form tags.
2: /// This is the success Action.
5: public ActionResult Success()
7: LoginModel model = new LoginModel();
8: return View(model);
13: public ActionResult Success(LoginModel model)
19: return View(model);
Note that we use the ActionName attribute “Success”. Normally you don’t have to do this. The ActionName is inferred from the method name. In Sitefinity Hybrid mode this is not the case.
1: @model SitefinityWebApp.Mvc.Models.LoginModel
5: @using (Html.BeginFormSitefinity("Success", "
In your MVC view, you’ll use the helper BeginFormSitefinity. A good convention is to use the name of the widget as the form name and we need to use the ActionName attribute “Success” in this sample to match our controller. Here we are posting a form with inputs.