Posted in: Comments

If you’re like me and don’t like the on-page-edit-right-click-menu but still want provide a simple shortcut for editors to edit the current page.

Our markup...

<a href="<%= CurrentPage.EditURL() %>">Edit this page</a>

... and our extension method

public static string EditURL(this PageData page)
{
    string baselink = UriSupport.AbsoluteUrlFromUIBySettings("edit/");

    return string.Format(
        "{0}SwitchLanguage.aspx?language={1}&epUrl={2}",
        baselink,
        page.LanguageBranch,
        HttpUtility.UrlEncode(string.Concat(baselink, "default.aspx?id=", page.PageLink.ToString())));
}

Of course you have check access rights before rendering the link.