Is any way how to find you whether some node exists in web config? SPWebConfigModification? or some other class? I belive there must be way how to find it out.


  • Why do you want to check that? And which web.config should SharePoint check? There can be any number of web applications and servers. Commented May 21, 2012 at 19:02
  • Server is the only one, and application which is activating this feature. This I have solved bud I need to add/remove sections with custom type, and also write those sections into sharepoint config, which is for this app (shared) (as I understand, each app dosen't have own config). I guess this is not good way how to do it. However, ps scripts should be able much easier perform these updates.
    – Peter P
    Commented May 22, 2012 at 6:58
  • SPWebConfigModification is the way to add entries to the web.config in SharePoint, if made right they'll make sure that the sections are added when the first feature needing them are activated and removed when the last feature needing them are deactivated. You don't need to know if the section already exists you just need to specify that you need it. Commented May 22, 2012 at 8:52
  • I need to inject custom values for application not for features. Before inject I have to be sure that I'm not going to insert some duplicit configuration. In sharepoint isn't any way how to force ConfigurationManager to point to application config? These stuffs around config are totaly disaster ... God bless ASP.NET MVC
    – Peter P
    Commented May 22, 2012 at 11:22
  • What do you mean by application not feature? SPWebConfigModifications will not cause multiple entries. It's SharePoint so it's intelligent, not ASP.NET where you have to do everything yourselves. Commented May 22, 2012 at 11:29

1 Answer 1


The SPWebConfigModification, as you may already be aware, is used purely to make changes to the web.config in SharePoint which can then be propagated across a farm.

To check for the existence of a section you may be able to use the WebConfigurationManager from the System.Web.Configuration namespace (System.Web assembly) - see http://msdn.microsoft.com/en-us/library/system.web.configuration.webconfigurationmanager(v=vs.90).aspx.

Hope this helps.

  • maybe ... I've lost few days with feature deployment ... I'm going to write ps scripts, and hope one day I will forget this sharepoint nightmare... this is crazy technology ...
    – Peter P
    Commented May 21, 2012 at 14:38
  • I think technology is very good. You need some training how to create custom solution and deployment in SharePoint.
    – user994521
    Commented Mar 11, 2013 at 23:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.