Dennis Bottjer | ASP.NET + SharePoint Architect, Trainer & Speaker

"An Ounce of Prevention is Worth a Pound of Cure" - Ben Franklin
posts - 168, comments - 59, trackbacks - 41

My Links

News

Add to Technorati Favorites The views expressed in this blog are mine and mine alone, not that of my employer, Microsoft, or anyone else’s. No warrantee is given for the quality of any material on this site.

Tag Cloud

Archives

Post Categories

Web.Config Modification Manager for SharePoint

Contrary to popular belief it is possible to programmatically manipulate the SharePoint's web.config.  When attempting to programmatically manipulate the web.config it is wise to have a utility to promptly roll back your modifications.  The Kid has provided us with just such a utility.

Download Web.Config Modification Manager For SharePoint 

The Modification Manager is available in both an application page (ASPX) and solution setup versions.  If you download the application page version you will notice the following code which is used to remove modification from the web.config. Notice that the code first removes the modification, then an update is done on the oApp object, and finally the ApplyWebConfigModifications() method is called.

   1: for (int i = l.Count - 1; i >= 0; i--)
   2:   oApp.WebConfigModifications.Remove( oApp.WebConfigModifications[l[ i ]] );
   3:   if (oApp.WebConfigModifications.Count < iStartCount)
   4:   {
   5:      oApp.Update();
   6:      SPFarm.Local.Services.GetValue<SPWebService>().ApplyWebConfigModifications();
   7:   }
 

Print | posted on Tuesday, November 25, 2008 1:22 AM | Filed Under [ SharePoint ]

Comments have been closed on this topic.

Powered by: