How to get the proper url from a multi lingual page

Ross Austen asked on September 19, 2019 00:03

I am trying to get the the url from a page on a multi-lingual Kentico site in simple ascx c# web control that is being used as a web part. The objective is pick up the translation culture in use.

The url in the browser shows. http://psychoanalysis.today/en-GB/Editors/Acknowledgements.aspx

protected void Page_Load(object sender, EventArgs e)
{
    string translatelabels = HttpContext.Current.Request.Url.AbsoluteUri;

But the output from HttpContext.Current.Request.Url.AbsoluteUri; is

http://psychoanalysis.today/CMSPages/PortalTemplate.aspx?aliaspath=%2fEditors%2fAcknowledgements

Correct Answer

Peter Mogilnitski answered on September 19, 2019 15:51

should be something like this:

<%@ Import Namespace="CMS.DocumentEngine" %>
...
<%=CurrentDocument.AbsoluteURL%>

P.S. Take a look at this topic as well

1 votesVote for this answer Unmark Correct answer

   Please, sign in to be able to submit a new answer.