Not being able to set LinkUrl with ConstructContentUri on ContentProvider

Member since: 2007

Upgrade from CMS 7.19.2 to 8.10

Scenario: In ContentProvider, i mirror a news article to another place on the site, i want to change the Url (LinkUrl):

It is not possible any longer to set (mirrored).LinkURL = base.ConstructContentUri(mirrored.ContentTypeID, mirrored.ContentLink, mirrored.ContentGuid).ToString();

It does an eternal loop (read down to up) it always reloading "LoadContent"-method in contentprovider.

 	EPiServer.dll!EPiServer.Core.ContentProvider.LoadContentFromCacheOrRepository.AnonymousMethod__22()	Unknown
 	EPiServer.dll!EPiServer.Core.OptimisticCache<EPiServer.Core.IContent>.Read(string cacheKey, EPiServer.Core.ReadAndCacheObject<EPiServer.Core.IContent> readAndCacheObject)	Unknown
 	EPiServer.dll!EPiServer.Core.ContentProvider.LoadContentFromCacheOrRepository(EPiServer.Core.ContentReference contentreference, EPiServer.Core.ILanguageSelector selector)	Unknown
 	EPiServer.dll!EPiServer.Core.ProviderPipelineImplementation.GetItem(EPiServer.Core.ContentProvider provider, EPiServer.Core.ContentReference contentLink, EPiServer.Core.LoaderOptions loaderOptions)	Unknown
 	EPiServer.dll!EPiServer.Core.DefaultContentLoader.TryGet<EPiServer.Core.IContent>(EPiServer.Core.ContentReference contentLink, EPiServer.Core.LoaderOptions loaderOptions, out EPiServer.Core.IContent content)	Unknown
 	EPiServer.dll!EPiServer.Core.DefaultContentLoader.Get<EPiServer.Core.IContent>(EPiServer.Core.ContentReference contentLink, EPiServer.Core.LoaderOptions loaderOptions)	Unknown
 	EPiServer.dll!EPiServer.Core.ContentLanguageSettingsHandler.GetClosestSettingNoCache(EPiServer.Core.ContentReference contentLink, System.Collections.Generic.Dictionary<EPiServer.Core.ContentReference,EPiServer.DataAbstraction.ContentLanguageSetting[]> allSettings)	Unknown
 	mscorlib.dll!System.Collections.Concurrent.ConcurrentDictionary<System.__Canon,System.__Canon>.GetOrAdd(System.__Canon key, System.Func<System.__Canon,System.__Canon> valueFactory)	Unknown
 	EPiServer.dll!EPiServer.Core.ContentLanguageSettingsHandler.GetClosestSetting(EPiServer.Core.ContentReference contentLink)	Unknown
 	EPiServer.dll!EPiServer.Core.ContentLanguageSettingsHandler.Get(EPiServer.Core.ContentReference contentLink)	Unknown
 	EPiServer.Business.Commerce.dll!EPiServer.Commerce.Catalog.CatalogLanguageSettingsHandler.Get(EPiServer.Core.ContentReference contentLink)	Unknown
 	EPiServer.dll!EPiServer.Core.ContentLanguageSettingsHandler.Get(EPiServer.Core.ContentReference contentLink, string languageBranch)	Unknown
 	EPiServer.dll!EPiServer.Core.LanguagePipeline.Pipe(EPiServer.Core.ContentReference contentLink, EPiServer.Core.IContent contentInstance, EPiServer.Core.LoaderOptions loaderOptions, System.Func<EPiServer.Core.ContentReference,System.Globalization.CultureInfo,EPiServer.Core.IContent> loadingDelegate)	Unknown
 	EPiServer.dll!EPiServer.Core.ProviderPipelineImplementation.GetItem(EPiServer.Core.ContentProvider provider, EPiServer.Core.ContentReference contentLink, EPiServer.Core.LoaderOptions loaderOptions)	Unknown
 	EPiServer.dll!EPiServer.Core.DefaultContentLoader.TryGet<EPiServer.Core.IContent>(EPiServer.Core.ContentReference contentLink, EPiServer.Core.LoaderOptions loaderOptions, out EPiServer.Core.IContent content)	Unknown
 	EPiServer.dll!EPiServer.Web.Routing.DefaultUrlResolver.GetVirtualPathInternal(EPiServer.Core.ContentReference contentLink, string language, EPiServer.Web.Routing.VirtualPathArguments arguments)	Unknown
 	EPiServer.dll!EPiServer.Web.Routing.UrlResolver.GetUrl(EPiServer.Core.ContentReference contentLink, string language)	Unknown
 	EPiServer.Business.Commerce.dll!EPiServer.Commerce.Routing.RequestCacheUrlResolver.GetVirtualPath(EPiServer.Core.ContentReference contentLink, string language, EPiServer.Web.Routing.VirtualPathArguments virtualPathArguments, System.Func<string> getVirtualPathAction)	Unknown
 	EPiServer.Business.Commerce.dll!EPiServer.Commerce.Routing.RequestCacheUrlResolver.GetUrl(EPiServer.Core.ContentReference contentLink, string language)	Unknown
 	EPiServer.dll!EPiServer.Web.Routing.Segments.GuidSegment.RouteDataMatch(EPiServer.Web.Routing.Segments.SegmentContext context)	Unknown
 	System.Core.dll!System.Linq.Enumerable.All<EPiServer.Web.Routing.Segments.ISegment>(System.Collections.Generic.IEnumerable<EPiServer.Web.Routing.Segments.ISegment> source, System.Func<EPiServer.Web.Routing.Segments.ISegment,bool> predicate)	Unknown
 	EPiServer.dll!EPiServer.Web.Routing.ContentRoute.RouteSegmentContext(EPiServer.Web.Routing.Segments.SegmentContext segmentContext)	Unknown
 	EPiServer.dll!EPiServer.Web.Routing.DefaultUrlResolver.RouteInternal(EPiServer.UrlBuilder urlBuilder, EPiServer.Web.ContextMode contextMode)	Unknown
 	EPiServer.dll!EPiServer.Web.Routing.DefaultUrlResolver.ConvertToPermanent(EPiServer.UrlBuilder url)	Unknown
 	EPiServer.dll!EPiServer.Web.Routing.DefaultUrlResolver.TryToPermanent(string url, out string permanentUrl)	Unknown
 	EPiServer.dll!EPiServer.SpecializedProperties.PropertyUrl.String.set(string value)	Unknown
 	EPiServer.dll!EPiServer.Core.PropertyData.SetPropertyValue(object value, EPiServer.Core.SetPropertyValueDelegate doSet)	Unknown
 	EPiServer.dll!EPiServer.Core.PageData.LinkURL.set(string value)	Unknown

Any ideas why? Something has changed, maybe caused to the Classic link being removed?

#131831 Aug 06, 2015 13:45
  • Member since: 2007

    ok, found another way,

    In the repeater i replaced

     NavigateUrl='<%# DataBinder.Eval(Container.DataItem, "LinkURL") %>'

    with

     NavigateUrl='<%# EPiServer.Web.Routing.UrlResolver.Current.GetUrl(Container.DataItem as EPiServer.Core.IContent) %>'

    And in my Contentprovider i Do NOT use ConstructContentUri and is setting mirrored.LinkURL = "";

    Accually when i was faking mirrored.LinkUrl = "/link/" + mirrored.ContentGuid.ToString().ToLower().Replace("-", "") + ".aspx"; same as usually ConstructContentUri  was returned IT DID LOOP. So my conclusion was that ConstructContentUri is not saving on the right place or not to be used in the case you use CreateWritableClone:

    var mirrored = original.CreateWritableClone()

    #131836 Aug 06, 2015 16:31
This topic is locked because the last reply was posted more than 6 months ago. Please contact epw@episerver.com to unlock it.