Posts

Showing posts with the label SPWebConfigModification

Modifying web.config programatically (SharePoint2010)

Here i'm going to add 2 web.config entries through code first i'm taking the backup copy of the original web.config and i'm adding the new entries. Code shown below... using System ; using System.Collections.Generic ; using System.IO ; using System.Linq ; using System.Text ; using Microsoft.SharePoint ; using Microsoft.SharePoint.Administration ; using System.Web.Administration ; using System.Configuration ; using System.Web ; using System.Web.Configuration ; using System.Reflection ; using System.Xml ; using System.Xml.Xsl ; using System.Xml.Serialization ; using System.Xml.XPath ; namespace ConsoleApplicationWebConfigBackUp { class Program { static void Main ( string [] args) { ApplyWebConfigModifications( "http://localhost:5050" ); //Taking the backup of the web.config file string physicalPath = oSite.WebApplication.IisSettings[SPUrlZone.Default].Path.ToString(); File.Copy(physical...