Don't miss out Virtual Happy Hour this Friday (April 26).
Try our conversational search powered by Generative AI!
AI OnAI Off
Don't miss out Virtual Happy Hour this Friday (April 26).
Here is how we do it:
var pageReference = ???
var urlResolver = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance<EPiServer.Web.Routing.UrlResolver>();
var pageUrl = urlResolver.GetVirtualPath(pageReference);
Redirect(pageUrl);
Look here for more information: http://joelabrahamsson.com/episerver-7-and-mvc-getting-the-url-for-a-page/
Greetings
Hi,
just taking my baby steps in the world of MVC and EPi. What is correct way to redirect from controller to another page provided that I have the redirection target as PageReference/PageData?
I was looking at RedirectToRoute but couldn't yet figure out how to resolve route for page from PageReference/PageLink?
Response.Redirect of course works but seemed to as not the most elegant solution? Or I am just making simple task too complicated?
Any advice appreciated!