SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


share|improve this question
Why do you want to check that? And which web.config should SharePoint check? There can be any number of web applications and servers. – Per Jakobsen May 21 '12 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 May 22 '12 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. – Per Jakobsen May 22 '12 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 May 22 '12 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. – Per Jakobsen May 22 '12 at 11:29

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

Hope this helps.

share|improve this answer
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 May 21 '12 at 14:38
I think technology is very good. You need some training how to create custom solution and deployment in SharePoint. – user994521 Mar 11 '13 at 23:04
I agree with Peter (and i've been doing SP Development for 7+ years now) The dev/deployment model is absolutely batshit insane. – Pierreten Mar 26 '13 at 5:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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