Get public url's from edit mode

Vote:
 

Hi!,

I'm running out of ideas to how to get to public url from page being in edit mode.


In my case I'm using Alloy MVC example project and lets say in edit mode in some page and having it's url:
http://localhost/EPiServer/CMS/?language=en#context=epi.cms.contentdata:///6_6

and I need to get it's published url to view (once published)

http://localhost:60003/en/alloy-plan/

I'm able to get separatly host, port or linkURL like"/link/ea0b8a46cc7f4d149b6a9e760f970314.aspx?epslanguage=en" values and I wonder if this is possible to get ready url from EPI - I cannot dig it.

Thanks in advance

#175925
Mar 06, 2017 16:07
Vote:
 

Hi Monika,

To get a friendly URL inside the edit mode, you can use the following code:

string friendlyUrl = UrlResolver.Current.GetUrl(
                        currentPage.ContentLink,
                        null,
                        new VirtualPathArguments { ContextMode = ContextMode.Default });
#175929
Mar 06, 2017 17:53
Vote:
 

... and if you want an absolute/external URL http://dodavinkeln.se/post/how-to-get-the-external-url-to-content

#175933
Mar 06, 2017 20:18
* 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.