[Skip to content]

Search our Site
Easysite Resource Centre
Current Page url

Current Page url

There are times when a code widget needs the current page url inserting into the code using C#

Typically this is used by external code widgets which post the current url to an external site - such as Facebook, Twitter or Browsealoud.

Older styles may use code which references:

<%=CurrentRequest.Domain %><%=CurrentPagePath %>

These methods are outdated and will cause the page to error and not load correctly in Easysite 7.

In Easysite 7 this code should be replaced by:

<%=RequestContext.Url.Host %><%=RequestContext.Url.AbsolutePath %>