Change default url rewrite provider with .xmlupdate file

Vote:
 

Im looking to create a episerver.config.xmlupdate file to be used for modifying some config settings. This can be executed through the EPi deployment center as part of a website installation process.

Specifically, I want to add an additional url rewriter and make it the default for the website.

Adding the additional provider is easy, but im stumped on how to change the defaultProvider attribute on the urlRewrite element.

<?xml version="1.0" encoding="utf-8"?>
<modifications>
  
  <!-- Add our own url rewriter -->
  <add path="/urlRewrite/providers/sizePresets" xmlns="http://EPiServer.Configuration.EPiServerSection">
    <add name="My Url Rewriter" description="My Url Rewriter Description" type="MyDll.Type,MyDll" __keyAttributes="name" />
  </add>
  
  <!-- set it to be the default -->
  <!-- help! -->
  
</modifications>

Can anyone point me in the direction of some documentation around the syntax or an example of where this may have been done on a open source project?

Many thanks,

Adam

#59891
Jul 03, 2012 23:46
Vote:
 

Hi Adam.

Here you can find XML Update reference: http://world.episerver.com/Documentation/Items/Tech-Notes/EPiServer-CMS-5/EPiServer-CMS-5-R2-SP1/XML-Update-Reference/

Try to use SetAttribute: 

<setAttribute path="/configuration/epi:episerver/epi:urlRewrite" attributeName="defaultProvider" attributeValue="MyUrlRewriter" />

    

#59901
Jul 04, 2012 8:55
Vote:
 

Perfect - Thanks Sergii - Exactly what I was looking for.

The finished article (as simple as it is!)

<modifications>
  <!-- Add our own url rewriter -->
  <add path="/episerver/urlRewrite/providers">
    <add name="MyUrlRewriter" description="My Url Rewriter Description" type="MyDll.MyUrlRewriter,MyDll" __keyAttributes="name" />
  </add>
  
  <!-- set it to be the default -->
  <setAttribute path="/episerver/urlRewrite" attributeName="defaultProvider" attributeValue="MyUrlRewriter" />
</modifications>

After taking a look at the powershell scripts which perform the merge it tuned out I didnt need the namespacing either.

#59917
Jul 04, 2012 22:05
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.