How to patch an attribute value with a Sitecore Include file

Kevin Obee picture Kevin Obee · May 25, 2013 · Viewed 7.4k times · Source

I need to create a Sitecore include patch file to add a string to the existing value attribute of the IgnoreUrlPrefixes setting in the web.config.

I have tried to overwriting the default ignored prefixes entirely 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 identifies that the modified configuration has not been applied.

Ideally I would like to be able to simply add /foo/ to whatever exists as the default IgnoreUrlPrefixes values. Does anyone know if this is possible and how to specify it in Sitecore patch syntax?

Answer

Marek Musielak picture Marek Musielak · May 25, 2013

Good explanation of all possibilities of Sitecore include config files can be found in this John West blog post.

As you can find in the linked post:

patch:attribute: Define or replace the specified attribute.

It does not allow to "add /foo/ to whatever exists as the default IgnoreUrlPrefixes" attribute.