Just a quick note here.
When you are adding a web.config entry via the SPWebConfigModification class, you need to specify a Name for the modification. Typically, it will look something like this: add[@name=\"CustomSiteMapProvider\"] . It is an XPath expression to uniquely identify the modification. The tricky part is that this name must match the name= parameter in the string added to the web.config (assuming you have one).
In other words, this is OK:
Name= add[@name=\"CustomSiteMapProvider\"]
Value= <add name='CustomSiteMapProvider' type='MyNS.MyClass, MyDLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxx' description='Custom site map provider' NavigationType='Global' />
Whereas this is NOT OK:
Name= add[@name=\"CustomSiteMapProvider\"]
Value= <add name='MyNewSiteMapProvider' type='MyNS.MyClass, MyDLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=xxx' description='Custom site map provider' NavigationType='Global' />
Note the difference in the name attribute in the Value and the Name of the modification.
This will become a problem when you attempt to REMOVE the entry. You will not be able to.