Hi,
i work in an IT consultant and currently i'm having a problem in depolying sharepoint 2010 solution.
the solution which i created require the web config of the targeted web application to be modified, however this must be done programmatically during the deployment using WSP.
i have tried several solutions which i found but all of them is leading to modifying all web config in the application pool, i don't want that to happen because the target is only 1 web application.
the piece of code that i use already point to the specific web application but still when i deploy the solution, all web config files are affected.
here is the piece of code that i use :
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
SPWebService service = SPWebService.ContentService;
SPWebConfigModification myModification = new SPWebConfigModification();
SPSite site = new SPSite("http://win-a52s8epvot4:888/");
SPWeb web = site.OpenWeb();
myModification.Path = "configuration/appSettings";
myModification.Name = "add[@key='SQLArchiveConnectionString'][@value='Data Source=WIN-A52S8EPVOT4;Initial Catalog=TRAEmployee;User ID=sa;Password=P@ssw0rd;Persist Security Info=False;']";
myModification.Sequence = 0;
myModification.Owner = "administrator";
myModification.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
myModification.Value = "<add key='SQLArchiveConnectionString' value='Data Source=WIN-A52S8EPVOT4;Initial Catalog=TRAEmployee;User ID=sa;Password=P@ssw0rd;Persist Security Info=False;' />";
web.Site.WebApplication.WebConfigModifications.Add(myModification);
service.Update();
service.ApplyWebConfigModifications();
}need advise or help urgently...
regards,
-WN-
-Regards- Willy Noviandy