Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Odd URLs while logged in after upgrading to latest


We are on CMS 12.  We upgraded all our NuGet packages to the very latest version and after doing this, when we open a page by using the View on website link in the CMS, all the links on the page are generated like this:,,2705?epieditmode=true

instead of like this:

If I open the site in an incognito window where I'm not logged into the CMS, this does not happen.  This only happens if I open a page in the same browser window where I'm also logged into to the CMS.

Is this expected behavior with the latest version of CMS 12?  Is there a setting that controls this?

Edited, Mar 23, 2023 0:34

Seems like you are getting or using internal links, typically you should check your code so that the contextMode isn't contextMode.Edit

Care to post a bit of code showing how you output these links in your templates?

Edited, Mar 23, 2023 8:22

This is our "GetUrlLink" method:

public string GetUrlLink()
    if (PhoneNumber.IsNotNullAndNotWhiteSpace())
        return $"tel:{PhoneNumber}";
    else if (UrlLink != null)
        if (UrlLink.Scheme.Equals("mailto", StringComparison.OrdinalIgnoreCase))
            return UrlLink.OriginalString;
            var urlResolver = ServiceLocator.Current.GetInstance<UrlResolver>();
            var pageRouteHelper = ServiceLocator.Current.GetInstance<IPageRouteHelper>();

            var currentPageUrl = urlResolver.GetUrl(pageRouteHelper.Page.ContentLink);

            if (currentPageUrl == urlResolver.GetUrl(UrlLink.Path) && UrlLink.Fragment.IsNotNullAndNotWhiteSpace() && UrlLink.Fragment.StartsWith("#"))
                return UrlLink.Fragment;

            return urlResolver.GetUrl(UrlLink.OriginalString);

    return string.Empty;

I'm thinking the problem is on the 2nd to last return statement:

return urlResolver.GetUrl(UrlLink.OriginalString);

Mar 23, 2023 11:41

Hi, I'm not to sure about that. The urllink should most likely look something like this /link/61104228962d4dd2925cb5b12e2373ee.aspx.

I'm sticking with my original guess that you have some issues with your ContextMode. Possibly that you use this method PageEditing.GetEditUrl to resolve the contentLink url. How do you feed the UrlLink property?

Mar 23, 2023 13:45

This is my UrlLink property:

    Name = "Link Url",
    GroupName = SystemTabNames.Content,
    Order = 100)]
public virtual EPiServer.Url UrlLink { get; set; }
Mar 23, 2023 15:41

Tried your code, added a property just like yours and it works just fine. 

Check your contextmode by running

var contextModeResolver = ServiceLocator.Current.GetInstance<EPiServer.Web.IContextModeResolver>();
// the context mode is available in
var contextMode = contextModeResolver.CurrentMode;

Typically you want ContextMode.Default

Mar 23, 2023 20:47
* 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.