1

In code utilizing SPWebConfigModification what would the typical reasons be for wanting to modify

Two examples I know of are: Adding a Safe control to the config, and making general changes to the appsettings section.

Are there more, if so, what?

2
  • Custom web service endpoint to add ?
    – Steve B
    Commented Jan 18, 2012 at 16:18
  • @moderators: isn't this question suitable for a wiki question ?
    – Steve B
    Commented Jan 18, 2012 at 16:46

2 Answers 2

1

For me pretty much the only real need for web.config modifications are:

  • HttpModules
  • HttpHandlers
  • Assembly redirects
  • Custom navigation provider
  • Custom membership provider
  • Namespace loading (i.e. enable web app to use any control in a namespace / assembly without havign to add a page level assembly / namespace directive on every (layout) page

SafeControls should be set by a solution manifest on deployment to a webapp (WSPBuilder and Visual Studio for SP2010 add a SafeControl entry to the solution manifest automatically when needed).

I prefer to store AppSettings in the SPWebApplication's PropertyBag (or in the PropertyBag of say an SPSite.RootWeb, this way, if need be they can be changed using SharePoint Designer or changed using a custom Application Page (in Central Admin).

Furthermore, SP2010 has the SecureStore Service, which you can use to store user names, passwords and connection strings (pretty much any config value).

Edit:

WCF services i usually deploy using MultipleBaseAddressBasicHttpBindingServiceHostFactory (SOAP) or MultipleBaseAddressWebServiceHostFactory (REST). This way SharePoint handles all settings like security endpoint etc.

1
  • I do the same with my WCF bindings... good addition there
    – dbobrowski
    Commented Jan 18, 2012 at 20:01
1

You can pretty much do any modification that your application needs. The benefit of using that class is that it updates the web.config on all servers in your farm. Most common ones are:

  1. Adding Safe Controls
  2. AppSettings (I prefer to use storing configuration in content database though)
  3. Add Authorized types for workflow actions and conditions
  4. Change the trust level
  5. Add a navigation provider or modify existing provider settings
1
  • 6. Third party library requiring custom settings 7. WCF client Endpoint and behavior setup.
    – Steve B
    Commented Jan 18, 2012 at 16:46

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.