Posts Tagged ‘mvc’

Run your MVC controller ignoring SiteCore 6.6 Pipeline….

there are 3 Steps to do to achieve it:

1) write your controller inheriting from Controller

public class TestController : Controller


[ HttpGet]

public ActionResult Stelio()


//This throw an exception

//var footerRoot = Sitecore.Context.Database.GetItem(“/sitecore/content/Global/Footer”);

return Content( “this is a test to run an MVC controller in a SiteCore 6.6 site outside of SiteCore Context” );



2) Exlude the URL from the web.config

<setting name=”IgnoreUrlPrefixes” value=”/TestController/Stelio|/sitecore/default.aspx|/trace.axd|/webresource.axd|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.DialogHandler.aspx|/sitecore/shell/applications/content manager/telerik.web.ui.dialoghandler.aspx|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.SpellCheckHandler.axd|/Telerik.Web.UI.WebResource.axd|/sitecore/admin/upgrade/|/layouts/testing “/>

3) Register your route

public static void RegisterRoutes(RouteCollection routes)


routes.IgnoreRoute( “{resource}.axd/{*pathInfo}”);


“Default”, // Route name

“{controller}/{action}/”, // URL with parameters

new { controller = “TestController”, action = “stelio” , } );


Remember that you cannot use SiteCore Context (Sitecore.Context will throw an exception)

Categories: DEV Tags: , , ,