Hi,
When there is an ajax call made to a controller action method and the Controller is derived from Glass controller, I am getting below exception in log.
Sitecore.Diagnostics.Log.Error(:0)ocation ERROR Failed to create SitecoreContext
Exception: System.InvalidOperationException
Message: Attempt to retrieve context object of type 'Sitecore.Mvc.Presentation.RenderingContext' from empty stack.
Source: Sitecore.Mvc
at Sitecore.Mvc.Common.ContextService.Peek[T]()
at Glass.Mapper.Sc.Web.Mvc.GlassController..ctor()
I have defined the rout for ajax calls to sitecore mvc controller as below
routes.MapRoute(
name: "Client", // Route name
url: "client/{controller}/{action}/{id}", // URL with parameters
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
Please suggest what can be done not to get this exception while making the Ajax call to sitecore MVC controller action method where the controller class is derived from GlassController class ?
Thanks,
Santanu