After update to V8.1 from V6.1, our MVC custom code not working, it returned 404 (custom code is some APIs read content and commerce data using Sitefinity APIs).
According to documentation "here" , it said that "Bootstrapper.MVC.MapRoute is removed. Call the 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 the routing still not working.
Here is a sample 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 here is how we bind routing in global.ascx
:
protected void Application_Start(object sender, EventArgs e)
{
RouteConfig.RegisterRoutes(RouteTable.Routes); //the first method in that post
Bootstrap.BootstrapSitefinity();
}
Any idea how can we resole that?