MVC Routing

Neil Perry
Member since: 2011
 

I am having issue creating a custom route which is not using CMS content, for example I want to use for javascript on the client side

 

I have add a standard MVC controller

 

public class mytestController : Controller
{
//
// GET: /mytest/

public ActionResult Index()
{
return View();
}

}

 

Added a entry into Global.asax.cs to test

 

protected override void RegisterRoutes(RouteCollection routes)
{

routes.MapRoute(
"mytestRoute", // Route name
"mytest/{action}", // URL with parameters
new { controller = "mytest", action = "Index" });


base.RegisterRoutes(routes);
}

 

I have not created a view as I want my breakpoint to hit the controller index to check it works, my project is based on the Alloy demo site.

I am using EPiServer 7 release, Windows 7 on IIS7.5 - .Net4 Intregrated App pool

 

#64124 Dec 11, 2012 11:03
  • Neil Perry
    Member since: 2011
     

    This seems to be working now I have registerd ASP.Net 4 in IIS again

    %windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -ir

    I now have folder in solution and controller works as expected.

    aspnet_client\system_web\system_web

    #64144 Dec 11, 2012 13:40
  • Corbin Camp
    Member since: 2012
     

    I've run into the same thing but I can't get this work at all. 404's every time I try to render the page with additional parameters.

    #65392 Jan 28, 2013 23:29
  • Neil Perry
    Member since: 2011
     

    Check the Reference to ‘System.Web.MVC’ is V4.0.30319

     

    Also these MVC Templates just released should also help

    http://world.episerver.com/Articles/Items/ASPNET-MVC-Templates-for-EPiServer-7-CMS/

    http://world.episerver.com/Download/Items/EPiServer-CMS/EPiServer-7---CMS/EPiServer-7-MVC-Templates/

     

     

     

     

    #65397 Jan 29, 2013 9:58
  • Corbin Camp
    Member since: 2012
     

    Got them, but I can't get them to load. CMS comes up but I can't create a page. Throws a contentLink is null error.

    #65429 Jan 29, 2013 17:58