I want to redirect or return another template after hijacking.
This is what i got. it only return the same template.
public class TestDocumentController : Umbraco.Web.Mvc.RenderMvcController
{
public override ActionResult Index(RenderModel model)
{
var home = model.Content.Site();
model = new RenderModel(home);
var firstChildDocument = model.Content.Children.FirstOrDefault();
if (firstChildDocument != null)
{
model = new RenderModel(firstChildDocument);
}
return View(model);
}
}
return new RedirectToUmbracoPageResult(int pageId); is exactly what i needed. Thanks.
What i tried to achieve is to redirect to the first child 'if exist' of TestDocument. Since TestDocument does not have a template and is only a "Folder". Then fallback would be to return to the frontpage.
Hijack umbraco route controller and redirect
Using Umbraco 7.5.11
I want to redirect or return another template after hijacking.
This is what i got. it only return the same template.
Any idears?
Hi Bo
I'm not overly sure what you are trying to achieve, but you could...
return a RedirectToUmbracoPageResult (that takes the id of the page you want to redirect to)
eg:
or because this is MVC, you can return the name of any view or path to it followed by the relevant model like so:
regards
Marc
return new RedirectToUmbracoPageResult(int pageId);
is exactly what i needed. Thanks.What i tried to achieve is to redirect to the first child 'if exist' of TestDocument. Since TestDocument does not have a template and is only a "Folder". Then fallback would be to return to the frontpage.
is working on a reply...