Geeks With Blogs
Dennis Bottjer | MVP

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:   }
 
Posted on Tuesday, November 25, 2008 1:22 AM SharePoint | Back to top


Comments on this post: Web.Config Modification Manager for SharePoint

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © DennisBottjer | Powered by: GeeksWithBlogs.net