How to redirect to any page (eg Home) from any MVC controller in Episerver? eg after login - redirect to the start page.
To redirect to any MVC action:
public ActionResult Index()
{
return RedirectToAction("Index", "Home");
}
Redirect to the configured start page of the site:
public ActionResult Index()
{
PageData startPage =
ServiceLocator.Current.GetInstance<IContentRepository>().Get<PageData>(ContentReference.StartPage);
// get URL of the start page
string startPageUrl = ServiceLocator.Current.GetInstance<UrlResolver>()
.GetVirtualPath(startPage.ContentLink, startPage.LanguageBranch);
return Redirect(startPageUrl);
}