Try our conversational search powered by Generative AI!

Product code appended to link

Vote:
 

Hi,

When creating links to Catalog Content in an XhtmlString editor the product code is appended as a querystring to the end of the url when it's rendered.

For example if I link to a Catalog Content with the code "hhtcf" the url will be renderd like this,

-------

http://mysite.se/myproductcategory/mysubproductcategory/hhtcf/?ec=hhtcf

-------

when rendering the property with propertyfor

------

@Html.PropertyFor(model => model.MainBody)

------

Is there a way to prevent this? We run commerce 8.16.1 and CMS 8.6.1.

/Viktor

#139151
Sep 25, 2015 12:41
Vote:
 

Hi,

Are you using CommerceUrlResolver by any change? I think the ec= part comes from it.

Regards,

/Q

#139189
Sep 25, 2015 13:19
Vote:
 

Hi,

How do I know if thats used? I did a quick search and could not find any references to the CommerceUrlResolver in the project.

/Viktor

#139199
Sep 25, 2015 13:45
Vote:
 

Hi,

Still don't understand where the querystring comes from. I have done some debugging and with debug logging turned on I don't get any log messages from the CommerceUrlResolver and I can see that that my custom PartialRoute for the entry is called and returns a PartialRouteData with the correct PartialVirtualPath (without querystring) when the XHTML field is rendered. But still the query string is added to the url. Any help is welcomed :)

-----

MyProject.Core.dll!MyProject.Core.Routing.EntryPartialRoute.GetPartialVirtualPath(MyProject.Core.Models.MetaData.SiteProductContent content, string language, System.Web.Routing.RouteValueDictionary routeValues, System.Web.Routing.RequestContext requestContext)
EPiServer.dll!EPiServer.Web.Routing.Segments.PartialSegment.GetVirtualPathSegment(System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteValueDictionary values, System.Collections.Generic.HashSet<string> usedValues)
EPiServer.dll!EPiServer.Web.Routing.ContentRoute.AddVirtualPathFromSegments(System.Text.StringBuilder virtualPath, System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteValueDictionary values, System.Collections.Generic.HashSet<string> usedValues, int lastNonDefaultIndex)
EPiServer.dll!EPiServer.Web.Routing.ContentRoute.GetVirtualPath(System.Web.Routing.RequestContext requestContext, System.Web.Routing.RouteValueDictionary values)
EPiServer.dll!EPiServer.Web.Routing.DefaultUrlResolver.GetUrlFromRoute(EPiServer.Core.ContentReference contentReference, string language, System.Web.Routing.RouteValueDictionary routeValues, System.Web.Routing.RequestContext requestContext)
EPiServer.dll!EPiServer.Web.Routing.DefaultUrlResolver.GetVirtualPathInternal(EPiServer.Core.ContentReference contentLink, string language, EPiServer.Web.Routing.VirtualPathArguments arguments)
EPiServer.dll!EPiServer.Web.Routing.UrlResolver.GetUrl(EPiServer.Core.ContentReference contentLink, string language, EPiServer.Web.Routing.VirtualPathArguments virtualPathArguments)
EPiServer.Business.Commerce.dll!EPiServer.Commerce.Routing.RequestCacheUrlResolver.GetVirtualPath(EPiServer.Core.ContentReference contentLink, string language, EPiServer.Web.Routing.VirtualPathArguments virtualPathArguments, System.Func<string> getVirtualPathAction)
EPiServer.Business.Commerce.dll!EPiServer.Commerce.Routing.RequestCacheUrlResolver.GetUrl(EPiServer.Core.ContentReference contentLink, string language, EPiServer.Web.Routing.VirtualPathArguments virtualPathArguments)
EPiServer.dll!EPiServer.Web.Mvc.Html.UrlResolverExtensions.GetShortcutAwareUrl(EPiServer.Web.Routing.UrlResolver urlResolver, string internalUrl, System.Web.Routing.RequestContext requestContext, EPiServer.IContentLoader contentLoader, out string linkText)
EPiServer.dll!EPiServer.Web.Mvc.Html.XhtmlStringExtensions.RenderFragment(EPiServer.Core.Html.StringParsing.IStringFragment fragment, System.Web.Mvc.HtmlHelper htmlHelper, EPiServer.Web.Routing.UrlResolver urlResolver, EPiServer.IContentLoader contentLoader, System.IO.TextWriter writer)
EPiServer.dll!EPiServer.Web.Mvc.Html.XhtmlStringExtensions.RenderXhtmlStringToWriter(System.Web.Mvc.HtmlHelper htmlHelper, EPiServer.Core.XhtmlString xhtmlString, EPiServer.Web.Routing.UrlResolver urlResolver, EPiServer.IContentLoader contentLoader, System.IO.TextWriter writer)
EPiServer.dll!EPiServer.Web.Mvc.Html.XhtmlStringExtensions.RenderXhtmlString(System.Web.Mvc.HtmlHelper htmlHelper, EPiServer.Core.XhtmlString xhtmlString)
App_Web_etc0px0h.dll!ASP.util_views_shared_displaytemplates_xhtmlstring_ascx.__Render__control1(System.Web.UI.HtmlTextWriter __w, System.Web.UI.Control parameterContainer)
System.Web.dll!System.Web.UI.Control.RenderChildrenInternal(System.Web.UI.HtmlTextWriter writer, System.Collections.ICollection children)
System.Web.dll!System.Web.UI.Control.RenderControlInternal(System.Web.UI.HtmlTextWriter writer, System.Web.UI.Adapters.ControlAdapter adapter)
System.Web.dll!System.Web.UI.Control.RenderChildrenInternal(System.Web.UI.HtmlTextWriter writer, System.Collections.ICollection children)
System.Web.Mvc.dll!System.Web.Mvc.ViewPage.Render(System.Web.UI.HtmlTextWriter writer)
System.Web.dll!System.Web.UI.Control.RenderControlInternal(System.Web.UI.HtmlTextWriter writer, System.Web.UI.Adapters.ControlAdapter adapter)
System.Web.dll!System.Web.UI.Page.ProcessRequestMain(bool includeStagesBeforeAsyncPoint, bool includeStagesAfterAsyncPoint)
System.Web.dll!System.Web.UI.Page.ProcessRequest(bool includeStagesBeforeAsyncPoint, bool includeStagesAfterAsyncPoint)
System.Web.dll!System.Web.UI.Page.ProcessRequest()
System.Web.dll!System.Web.UI.Page.ProcessRequest(System.Web.HttpContext context)
System.Web.Mvc.dll!System.Web.Mvc.ViewPage.ProcessRequest(System.Web.HttpContext context)
System.Web.Mvc.dll!System.Web.Mvc.ViewUserControl.ViewUserControlContainerPage.ProcessRequest(System.Web.HttpContext context)
System.Web.Mvc.dll!System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap.AnonymousMethod__3()
System.Web.Mvc.dll!System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap<System.__Canon>(System.Func<System.__Canon> func)
System.Web.dll!System.Web.HttpServerUtility.ExecuteInternal(System.Web.IHttpHandler handler, System.IO.TextWriter writer, bool preserveForm, bool setPreviousPage, System.Web.VirtualPath path, System.Web.VirtualPath filePath, string physPath, System.Exception error, string queryStringOverride)
System.Web.dll!System.Web.HttpServerUtility.Execute(System.Web.IHttpHandler handler, System.IO.TextWriter writer, bool preserveForm, bool setPreviousPage)
System.Web.dll!System.Web.HttpServerUtilityWrapper.Execute(System.Web.IHttpHandler handler, System.IO.TextWriter writer, bool preserveForm)
System.Web.Mvc.dll!System.Web.Mvc.ViewPage.RenderView(System.Web.Mvc.ViewContext viewContext)
System.Web.Mvc.dll!System.Web.Mvc.ViewUserControl.RenderView(System.Web.Mvc.ViewContext viewContext)
System.Web.Mvc.dll!System.Web.Mvc.Html.TemplateHelpers.ExecuteTemplate(System.Web.Mvc.HtmlHelper html, System.Web.Mvc.ViewDataDictionary viewData, string templateName, System.Web.UI.WebControls.DataBoundControlMode mode, System.Web.Mvc.Html.TemplateHelpers.GetViewNamesDelegate getViewNames, System.Web.Mvc.Html.TemplateHelpers.GetDefaultActionsDelegate getDefaultActions)
System.Web.Mvc.dll!System.Web.Mvc.Html.TemplateHelpers.TemplateHelper(System.Web.Mvc.HtmlHelper html, System.Web.Mvc.ModelMetadata metadata, string htmlFieldName, string templateName, System.Web.UI.WebControls.DataBoundControlMode mode, object additionalViewData, System.Web.Mvc.Html.TemplateHelpers.ExecuteTemplateDelegate executeTemplate)
System.Web.Mvc.dll!System.Web.Mvc.Html.TemplateHelpers.TemplateHelper(System.Web.Mvc.HtmlHelper html, System.Web.Mvc.ModelMetadata metadata, string htmlFieldName, string templateName, System.Web.UI.WebControls.DataBoundControlMode mode, object additionalViewData)
System.Web.Mvc.dll!System.Web.Mvc.Html.TemplateHelpers.TemplateFor<MyProject.Web.ViewModels.Pages.PageViewModel<MyProject.Core.Models.Pages.BlogPage>,EPiServer.Core.XhtmlString>(System.Web.Mvc.HtmlHelper<MyProject.Web.ViewModels.Pages.PageViewModel<MyProject.Core.Models.Pages.BlogPage>> html, System.Linq.Expressions.Expression<System.Func<MyProject.Web.ViewModels.Pages.PageViewModel<MyProject.Core.Models.Pages.BlogPage>,EPiServer.Core.XhtmlString>> expression, string templateName, string htmlFieldName, System.Web.UI.WebControls.DataBoundControlMode mode, object additionalViewData)
System.Web.Mvc.dll!System.Web.Mvc.Html.DisplayExtensions.DisplayFor<MyProject.Web.ViewModels.Pages.PageViewModel<MyProject.Core.Models.Pages.BlogPage>,EPiServer.Core.XhtmlString>(System.Web.Mvc.HtmlHelper<MyProject.Web.ViewModels.Pages.PageViewModel<MyProject.Core.Models.Pages.BlogPage>> html, System.Linq.Expressions.Expression<System.Func<MyProject.Web.ViewModels.Pages.PageViewModel<MyProject.Core.Models.Pages.BlogPage>,EPiServer.Core.XhtmlString>> expression)
EPiServer.dll!EPiServer.Web.Mvc.Html.PropertyRenderer.GetHtmlForDefaultMode<System.__Canon,System.__Canon>.AnonymousMethod__9(System.IO.StringWriter writer)
EPiServer.dll!EPiServer.Web.Mvc.Html.PropertyRenderer.CreateMvcHtmlString(System.Action<System.IO.StringWriter> action)
EPiServer.dll!EPiServer.Web.Mvc.Html.PropertyRenderer.PropertyFor<MyProject.Web.ViewModels.Pages.PageViewModel<MyProject.Core.Models.Pages.BlogPage>,EPiServer.Core.XhtmlString>(System.Web.Mvc.HtmlHelper<MyProject.Web.ViewModels.Pages.PageViewModel<MyProject.Core.Models.Pages.BlogPage>> html, string viewModelPropertyName, object additionalViewData, object editorSettings, System.Linq.Expressions.Expression<System.Func<MyProject.Web.ViewModels.Pages.PageViewModel<MyProject.Core.Models.Pages.BlogPage>,EPiServer.Core.XhtmlString>> expression, System.Func<string,System.Web.Mvc.MvcHtmlString> displayForAction)
EPiServer.dll!EPiServer.Web.Mvc.Html.PropertyExtensions.PropertyFor<MyProject.Web.ViewModels.Pages.PageViewModel<MyProject.Core.Models.Pages.BlogPage>,EPiServer.Core.XhtmlString>(System.Web.Mvc.HtmlHelper<MyProject.Web.ViewModels.Pages.PageViewModel<MyProject.Core.Models.Pages.BlogPage>> html, System.Linq.Expressions.Expression<System.Func<MyProject.Web.ViewModels.Pages.PageViewModel<MyProject.Core.Models.Pages.BlogPage>,EPiServer.Core.XhtmlString>> expression)

-----

/Viktor

#139887
Oct 08, 2015 17:37
* 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.