Views: 5467
Number of votes: 2
Average rating:

EPiServer CMS6 R2 and broken FriendlyUrlRewriteProvider

Ran into alot of problems yesterday while upgrading our website to the latest EPiServer version, CMS6 R2. The problem: I have made a custom FriendlyUrlRewriteProvider that inherits from EPiServer.Web.FriendlyUrlRewriteProvider that partly stopped working. My custom querystrings was discarded and the link click rendered into a 404 visit.

After alot of head scratching and dll and config checking I digged in to the EPiServer.dll of both the new and old version (CMS 6 and R2) and compared the two classes, method by method. Finally I realized that I needed to add an override for the method TryConvertToInternal with the same functionality as in ConvertToInternal (should have been obvious but I intend to always check the easiest solutions last).

Now the pager and all the other rewrites works as expected. This might not be the correct way to handle this but from what I can tell it works as it should.

Anyone with better solutions are more then welcome to comment on this.

    (By Johan Björnfot , 14 April 2011 07:25, Permanent link)

    Hi

    Unfortunately we had to make this "semantic breaking change" to the implemenation in Url rewriting to correct a bug regarding language handling.

    The suggested way if you have written a custom provider that override ConvertToInternal is to override TryConvertToInternal and move the logic there (just like you did).

    Sorry for the inconvenience this have caused...

    (By Ted , 14 April 2011 08:18, Permanent link)

    More people are having this problem, but I think the workaround is acceptable. If you'd talk to Deane Barker (@gadgetopia) you'd see he's had some frustration with FURL rewriters too. :)

    (By smithsson68 , 14 April 2011 10:02, Permanent link)

    Thanks for sharing Oskar.

    (By Kai de Leeuw , 11 September 2012 16:58, Permanent link)

    I did like this:

    public override bool TryConvertToInternal(UrlBuilder url, out CultureInfo preferredCulture, out object internalObject) {
    return (bool)typeof(EPiServer.Web.FriendlyUrlRewriteProvider).GetMethod("TryConvertToInternal", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(
    this,
    new[] { url, 0, preferredCulture = null, internalObject = null });
    }

    The alternative to doing this was to copy several hundred rows of code just to be able to send LanguageApiMode.Destructive which is required for the code in ConvertToInternalInternal to get called.

    (By Nitin Walawalkar , 14 July 2014 13:11, Permanent link)

    Hi I just upgraded from EiServer 5 R1 SP 2 to 6 R2 and found the URL not to be working, except the startpage.
    I get the below error:
    HTTP Error 404.0 - Not Found
    The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

    Any suggestions\solution to this

    (By Nitin Walawalkar , 14 July 2014 13:11, Permanent link)

    Hi I just upgraded from EpiServer 5 R1 SP 2 to 6 R2 and found the URL not to be working, except the startpage.
    I get the below error:
    HTTP Error 404.0 - Not Found
    The resource you are looking for has been removed, had its name changed, or is temporarily unavailable.

    Any suggestions\solution to this

  Please login to post a comment