volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

Get page from TinyMCE URL

Hey, I'm trying to get a page from TinyMCE content URL-s. Sometimes, the HTML code for them is ie. "/link/5e2e383dc27944599568d46b085d62d2.aspx" and sometimes, URL is a an Edit mode URL, ie. /EPiServer/CMS/Content/om-fonus/demo-page,,124/. It seems that the edit-mode URL is displayed on page load, but once you change the page selection, you get the /link/xxxx.aspx.

The following code works for the classic link, but not in the case of edit-mode:

public static PageData GetPageFromClassicUrl(string classicUrl)
        {
            string linkUrl;
            if (PermanentLinkMapStore.TryToMapped(classicUrl, out linkUrl))
            {
                var pageReference = PageReference.ParseUrl(linkUrl);

                if (!PageReference.IsNullOrEmpty(pageReference))
                {
                    var page = DataFactory.Instance.GetPage(pageReference, LanguageSelector.AutoDetect());
                    return page;
                }
            }
            return null;
        }

    

Does anyone know how to get the page from the latter (edit-mode) or should I parse the string and get the ID between a comma and a slash?

Thx!

#84315
Mar 31, 2014 15:20
Vote:

I have not tried this myself but could you not use UrlResolver.Route(UrlBuilder, ContextMode.Edit)? I think it should handle both url formats.

#84349
Apr 01, 2014 9:59
error This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.