How to fix attribute value using Sitecore Include file

I need to create a Sitecore patch file to add a line to the existing value attribute of the IgnoreUrlPrefixes parameter in the web.config file.

I tried to completely overwrite the default ignored prefixes with the following include file:

 <?xml version="1.0"?> <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <settings> <setting name="IgnoreUrlPrefixes"> <patch:attribute name="value">/foo/|/sitecore/default.aspx|/trace.axd|/webresource.axd|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.DialogHandler.aspx|/sitecore/shell/applications/content manager/telerik.web.ui.dialoghandler.aspx|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.SpellCheckHandler.axd|/Telerik.Web.UI.WebResource.axd|/sitecore/admin/upgrade/|/layouts/testing</patch:attribute> </setting> </settings> </sitecore> </configuration> </settings> 

Where /foo/ is the URL prefix that I would like to add to the default prefixes. ShowConfig.aspx indicates that the changed configuration has not been applied.

Ideally, I would just add /foo/ to what IgnoreUrlPrefixes defaults IgnoreUrlPrefixes . Does anyone know if this is possible and how to specify it in Sitecore patch syntax?

+8
sitecore sitecore6
source share
2 answers

A good explanation of all the features of Sitecore include config files can be found on this John West blog .

As you can find in the related post:

 patch:attribute: Define or replace the specified attribute. 

This does not allow "to add /foo/ to what exists as the default attribute IgnoreUrlPrefixes ".

+12
source share

I recently ran into this problem and it looks like Mark Ursino has posted a blog on this particular issue:

http://firebreaksice.com/sitecore-patchable-ignore-lists/

In his example, he runs his own pipeline after the standard Sitecore to update the value.

So instead, Ive created a new pipeline processor that appears after the built-in (which will support existing native IgnoreUrlPrefixes) and allow you to add each path through its own XML node configuration. The advantage here is that you can correct and continue the correction without having to copy the existing values.

Example patch file:

 <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> <sitecore> <pipelines> <httpRequestBegin> <processor type="Sitecore.PatchableIgnoreList.ProcessPatchedIgnores, Sitecore.PatchableIgnoreList" patch:after="processor[@type='Sitecore.Pipelines.HttpRequest.IgnoreList, Sitecore.Kernel']"> <Paths hint="list:AddPaths"> <foo>/foo</foo> <bar>/bar</bar> </Paths> </processor> </httpRequestBegin> </pipelines> </sitecore> </configuration> 

Source code for the pipeline processor, from the blog:

 using Sitecore.Collections; using Sitecore.Pipelines.HttpRequest; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Sitecore.PatchableIgnoreList { public class ProcessPatchedIgnores : HttpRequestProcessor { private List<string> _paths = new List<string>(); public override void Process(HttpRequestArgs args) { string filePath = args.Url.FilePath; foreach (string path in _paths) { if (filePath.StartsWith(path, StringComparison.OrdinalIgnoreCase)) { args.AbortPipeline(); return; } } } public void AddPaths(string path) { if (!string.IsNullOrEmpty(path) && !_paths.Contains(path)) { _paths.Add(path); } } } } 
+2
source share

All Articles