This project is read-only.

Configuration Manager 1.0

SharePoint configuration manager.


public override void FeatureActivated(SPFeatureReceiverProperties properties)
    var app = properties.GetWebApplication();
    var config = new ConfigurationManager(app, "MyWebAppFeature");

public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
    var app = properties.GetWebApplication();
    new ConfigurationManager(app, "MyWebAppFeature").RemoveAll().Update();
NOTE: This example uses the SPFeatureReceiverPropertiesExtension class.

Core Modifications

We're building out support for as many configuration sections as possible; however, we're only tackling the ones we need to support. Hopefully, we'll get this built out fairly quickly. Most modifications are easy to make, but having a class like this is much, much simpler.
  • <configSections>
    • <section name="..." type="..." requirePermission="..." allowDefinition="..." />
      • AddConfigurationSection(ConfigurationSection section)
    • <sectionGroup name="..." type="...">
      • AddConfigurationSection(ConfigurationSectionGroup group) -- Adds the configuration section group and any child configuration sections and section groups
  • <runtime>
    • <assemblyBinding>
      • <dependentAssembly>
        • AddDependentAssembly(Type assemblyType, string oldVersion)
        • AddDependentAssembly(string assemblyName, string assemblyPublicKeyToken, string oldVersion, string newVersion)
  • <system.codedom>
    • <compilers>
      • <compiler>
        • AddCodeDomCompiler(string language, string extension, int warningLevel, Type provider, Dictionary<string, object> providerOptions)
  • <system.web>
    • <compilation>
      • <assemblies>
        • <add assembly="..." />
          • AddCompilationAssembly(Type assemblyType)
          • AddCompilationAssembly(string assemblyFullName)
    • <httpHandlers>
      • <add verb="..." path="..." type="..." validate="..." />
        • AddHttpHandler(string verb, string path, Type handlerType)
        • AddHttpHandler(string verb, string path, Type handlerType, bool validate)
        • AddHttpHandler(string verb, string path, string assemblyQualifiedHandler)
        • AddHttpHandler(string verb, string path, string assemblyQualifiedHandler, bool validate)
      • <remove verb="..." path="..." />
        • RemoveHttpHandler(string verb, string path)
    • <httpModules>
      • <add name="..." type="..." />
        • AddHttpModule(Type moduleType)
        • AddHttpModule(string name, Type moduleType)
        • AddHttpModule(string name, string assemblyQualifiedModule)
      • <remove name="..." />
        • RemoveHttpModule(string name)
    • <pages>
      • <controls>
        • <add tagPrefix="..." namespace="..." assembly="..." />
          • AddControlNamespace(string prefix, Type namespaceType)
          • AddControlNamespace(string tagPrefix, string namespaceName, string assemblyFullName)
        • <add tagPrefix="..." tagName="..." src="..." />
          • AddControl(string tagPrefix, string tagName, string controlPath)
    • <xhtmlConformance mode="..." />
      • SetXhtmlConformance(XhtmlConformanceMode mode)
  • system.webServer
    • AddWebServer()
    • <handlers>
      • <add name="..." verb="..." path="..." preCondition="..." type="..." />
        • AddWebServerHandler(string verb, string path, string preCondition, Type handlerType)
        • AddWebServerHandler(string name, string verb, string path, string preCondition, Type handlerType)
        • AddWebServerHandler(string name, string verb, string path, string preCondition, string assemblyQualifiedHandler)
      • <remove name="..." />
        • RemoveWebServerHandler(string name)
    • <modules>
      • <add name="..." preCondition="..." type="..." />
        • AddWebServerModule(string preCondition, Type moduleType)
        • AddWebServerModule(string name, string preCondition, Type moduleType)
        • AddWebServerModule(string name, string preCondition, string assemblyQualifiedModule)
      • <remove name="..." />
        • RemoveWebServerModule(string name)
    • <validation validateIntegratedModeConfiguration="..." />
      • ValidateIntegratedMode(bool enabled)

Complex Modifications

Complex modifications aggregate other modifications for specific goals. There will be very few complex modifications, as we do not want to create modifications that aren't necessary; however, we do want to cover common scenarios as much as possible.
  • RegisterFramework35() -- Includes all web.config changes necessary to support .NET Framework 3.5 and ASP.NET AJAX). Of note, the *.asmx HTTP handler is not replaced with the .NET 3.5 version because it causes issues. Instead, this HTTP handler replacement should be made in a local web.config file in the directory with the ASMX services you plan to use as script services.

Additional Helper Methods

  • ContainsAny() -- Determines whether the configuration manager detects any currently registered web.config modifications
  • RemoveAll() -- Deletes all web.config modifications
  • Update() -- Persists all web.config modifications


Assembly: Synergy.SharePoint
Namespace: Synergy.SharePoint.Configuration
Class: ConfigurationManager

Last edited Jan 15, 2010 at 8:25 PM by flanakin, version 7


No comments yet.