public class TestController: Umbraco.Web.Mvc.RenderMvcController
{
public ActionResult Index(RenderModel model)
{
var finder = new ContentFinderByUrlAlias();
var nodeFound = finder.TryFindContent(UmbracoContext.PublishedContentRequest);
return base.Index(model);
}
}
However, the TryFindContent always return false. Can anyone let me know why is that?
ContentFinderByUrlAlias not working
Hi, I am trying to use ContentFinderByUrlAlias in my c# code.
I have my default controller set to:
DefaultRenderMvcControllerResolver.Current.SetDefaultControllerType(typeof(TestController));
and the code within my controller:
However, the TryFindContent always return false. Can anyone let me know why is that?
Thanks in advance.
Gary
Hi Gary,
What is it exactly that you are trying to achieve by your code?
I don't think ContentFinders are ment to be used within a controller, but by the Umbraco pipeline using the ContentFinderResolver.
So if you wish it to work prior to other IContentFinder You should do it on ApplicationStartEventHandler by calling
So you don't need actually override the default RenderMvcController
is working on a reply...