After upgrading to V8.1 from V6.1, our user MVC code does not work, it returned 404 (user code is some APIs that read content and commercial data using the Sitefinity API).
According to the documentation here , he said that βBootstrapper.MVC.MapRoute has been deleted. Call RouteTable.Routes.MapRoute (system .Web.Mvc) instead.β, So I changed my code from
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); Bootstrapper.MVC.MapRoute( "ExternalAccess", "baseApi/{controller}/{action}/{id}", new { controller = "MvcMainApiCntr", action = "Index", id = "" } ); }
to
public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "ExternalAccess", "baseApi/{controller}/{action}/{id}", new { controller = "MvcMainApiCntr", action = "Index", id = "" } ); }
But routing still does not work.
Here is an example of our MVC classes:
using System; using System.IO; using System.Net; using System.Web.Mvc; using HtmlAgilityPack; using Telerik.Sitefinity.Abstractions; namespace SitefinityWebApp.Mvc.Controllers { public class SharedAssetsController : Controller { [HttpGet] public ViewResult GetScripts() { var rootUrl = anyfunction(); return View("Scripts", (object) rootUrl); } } }
And this is how we bind routing in global.ascx :
protected void Application_Start(object sender, EventArgs e) { RouteConfig.RegisterRoutes(RouteTable.Routes);
Any idea how we can change this?