Quantcast
Channel: Using Optimizely Platforms
Viewing all articles
Browse latest Browse all 8020

Illegal characters in path rendering XHtmlString

$
0
0

We get a lot of logs looking like this

System.ArgumentException: Illegal characters in path.
   at System.IO.LongPathHelper.Normalize(String path, UInt32 maxPathLength, Boolean checkInvalidCharacters, Boolean expandShortPaths)
   at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   at System.IO.Path.GetFullPathInternal(String path)
   at System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
   at System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
   at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
   at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
   at System.Web.InternalSecurityPermissions.PathDiscovery(String path)
   at System.Web.HttpRequest.MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, Boolean allowCrossAppMapping)
   at System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage)
   at System.Web.HttpServerUtility.Execute(IHttpHandler handler, TextWriter writer, Boolean preserveForm)
   at System.Web.Mvc.ViewPage.RenderView(ViewContext viewContext)
   at System.Web.Mvc.ViewUserControl.RenderViewAndRestoreContentType(ViewPage containerPage, ViewContext viewContext)
   at System.Web.Mvc.ViewUserControl.RenderView(ViewContext viewContext)
   at System.Web.Mvc.Html.TemplateHelpers.ExecuteTemplate(HtmlHelper html, ViewDataDictionary viewData, String templateName, DataBoundControlMode mode, GetViewNamesDelegate getViewNames, GetDefaultActionsDelegate getDefaultActions)
   at System.Web.Mvc.Html.TemplateHelpers.TemplateHelper(HtmlHelper html, ModelMetadata metadata, String htmlFieldName, String templateName, DataBoundControlMode mode, Object additionalViewData, ExecuteTemplateDelegate executeTemplate)
   at System.Web.Mvc.Html.TemplateHelpers.TemplateHelper(HtmlHelper html, ModelMetadata metadata, String htmlFieldName, String templateName, DataBoundControlMode mode, Object additionalViewData)
   at System.Web.Mvc.Html.TemplateHelpers.TemplateFor[TContainer,TValue](HtmlHelper`1 html, Expression`1 expression, String templateName, String htmlFieldName, DataBoundControlMode mode, Object additionalViewData)
   at System.Web.Mvc.Html.DisplayExtensions.DisplayFor[TModel,TValue](HtmlHelper`1 html, Expression`1 expression)
   at EPiServer.Web.Mvc.Html.PropertyRenderer.<>c__DisplayClass12_0`2.<GetHtmlForDefaultMode>b__0(StringWriter writer)
   at EPiServer.Web.Mvc.Html.PropertyRenderer.CreateMvcHtmlString(Action`1 action)
   at EPiServer.Web.Mvc.Html.PropertyRenderer.PropertyFor[TModel,TValue](HtmlHelper`1 html, String viewModelPropertyName, Object additionalViewData, Object editorSettings, Expression`1 expression, Func`2 displayForAction)
   at EPiServer.Web.Mvc.Html.PropertyExtensions.PropertyFor[TModel,TValue](HtmlHelper`1 html, Expression`1 expression)
   at ASP._Page_Features_VehiclePage_PartialViews_DynamicBlocks__PremiumWarrantyBlock_cshtml.Execute()

The XhtmlString property has nothing special, just text and it's added to the ViewModel in the following way, reading a specific blocktypwe from a contentarea and checks if specified values match the current vehicle values. If so the viewmodel property gets set.

var premiumWarrantyBlocks = currentPage.PremiumWarranties?.FilteredItems.AsNotNull().Select(p => p.GetContent() as PremiumWarrantyBlock).ToList();
            foreach (var premiumWarrantyBlock in premiumWarrantyBlocks.AsNotNull())
            {
                if (VehicleHelper.IsPremiumSelection(premiumWarrantyBlock.MatchValues?.ToList(), vehicle))
                {
                    vehicleViewModel.PremiumWarrantyBlock = premiumWarrantyBlock;
                    break;
                }
                if (!premiumWarrantyBlock.MatchValues.AsNotNull().Any(matchValue =>
                    vehicleDescription.Contains(matchValue, StringComparison.OrdinalIgnoreCase))) continue;
                vehicleViewModel.PremiumWarrantyBlock = premiumWarrantyBlock;
                break;
            }

And rendered frontend using

@Html.PropertyFor(m => m.MainContent)

I have no clue to what causes this and loading the pages where this is used is working properly so I can't really debug it either.


Viewing all articles
Browse latest Browse all 8020

Trending Articles