Try our conversational search powered by Generative AI!

Not being able to set LinkUrl with ConstructContentUri on ContentProvider

Vote:
 

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.Read(string cacheKey, EPiServer.Core.ReadAndCacheObject 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.ContentReference contentLink, EPiServer.Core.LoaderOptions loaderOptions, out EPiServer.Core.IContent content)	Unknown
 	EPiServer.dll!EPiServer.Core.DefaultContentLoader.Get(EPiServer.Core.ContentReference contentLink, EPiServer.Core.LoaderOptions loaderOptions)	Unknown
 	EPiServer.dll!EPiServer.Core.ContentLanguageSettingsHandler.GetClosestSettingNoCache(EPiServer.Core.ContentReference contentLink, System.Collections.Generic.Dictionary allSettings)	Unknown
 	mscorlib.dll!System.Collections.Concurrent.ConcurrentDictionary.GetOrAdd(System.__Canon key, System.Func 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 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.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 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(System.Collections.Generic.IEnumerable source, System.Func 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
Vote:
 

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
* 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.