A while ago my colleges did EPiServer migration from version 7.0 to 7.19.2. It’s an ASP.NET Web Forms based solution. The solution was tested and it looked like all features were working. But last week they find out a problem with URL property. All links in the editor had format “/Template/Pages/…”. The property was used only on one page that’s why the issue didn’t appear earlier.
We have few sites with EPi 7.19.2, but all of them are MVC based where the property works as well as in EPiServer 7.5. We also tried to upgrade site to next available Nuget package (8.0) and it solved the problem. Customer has plans for platform migration in few months, so we had to temporary fix the problem temporary somehow.
So after selecting URL from “Edit link” dialog and saving the page, the selected URL was displayed as internal URL – /path/to/page.aspx?id=12521, for example /Templates/Pages/TestPageTemplate.aspx?id=12521. When we clicked edit URL, the blank dialog appeared:
We checked the database. The link was in permanent format – ~/link/[guid].aspx, for example ~/link/7f6a4c32594b479fb4fb512c57254135.aspx. So the problem was somewhere in the EPiServer.SpecializedProperties.PropertyUrl.
It turned out that String property was responsible for returning URL in internal format. We solve the problem by overriding it and converting result to permanent link.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
namespace CustomProperties { [PropertyDefinitionTypePlugIn(DisplayName = "CustomPropertyUrl")] public class CustomPropertyUrl : PropertyUrl { protected override string String { get { var currentLink = ""; if (this.UrlResolver.Service.TryToPermanent(base.String, out currentLink)) { return currentLink; } return base.String; } set { base.String = value; } } } } |
We are not sure if this is a problem in our solution or this is a bug in the CMS, but for now the problem is solved.