Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
Calling all developers! We invite you to provide your input on Feature Experimentation by completing this brief survey.
I use
var urlResolver = ServiceLocator.Current.GetInstance<UrlResolver>();
var listingPageUrl = urlResolver.GetVirtualPath(subPage.ParentLink, language);
and sometimes the PageEditing.GetPageIsInEditMode(httpContext) returns false
So I would like to know, how to get the page correct address in edit mode via url helper or somehow?
Hello,
There is a static helper method PageEdititng.GetEditUrl that accepts a ContentReference and returns URL in edit mode.
Hello,
Thank you for help.
Yes, it returns the edit url, but I need a little bit different page link in edit mode.
If you look at the generated site menu in edit mode, the links are not like
http://localhost:85/episerver/cms/#context=epi.cms.contentdata:///18
they are like
http://localhost:85/EPiServer/CMS/Content/EP11111,,11/?id=11&epieditmode=true
So, is it possible to get such view for link?
This link you can get by using one of the extension methods from EPiServer.Web.Routing.RouteCollectionExtensions class:
RouteTable.Routes.GetVirtualPath(subPage.ParentLink, language, true, true).GetUrl()
Sorry removed the post but the question was: how to get the same as above since it is obsolete.
Thanks
Hello,
Probably, something like this:
var virtualPathArguments = new VirtualPathArguments { ContextMode = ContextMode.Edit}; var url = ServiceLocator.Current.GetInstance<UrlResolver>().GetUrl(currentPage.PageLink, "en", virtualPathArguments);
Sorry removed the post but the question was: how to get the same as above since it is obsolete.
Thanks
This solution of Sergii Vorushylo works like a charm (in CMS10 as well)
EPiServer.Editor.PageEditing.GetEditUrl(contentLink);
How to get page url for edit mode?