This project is read-only.


  1. Import Project Template into Visual Studio 2010 by placing in C:\Users\<userid>\Documents\Visual Studio 2010\Templates\ProjectTemplates
  2. Build & Deploy WSP onto desired web application
  3. Activate Site Collection feature- 'PS Config Site Settings'

Create Config Modules

Create config modules as public classes with public string properties. Properties can be initialized in constructor to provide default values. See Samples folder for examples.

public class Links
    public Links()
        //Default Values
        MembershipProviderService = "http://domain/service.asmx";
        RoleProviderService = "http://domain/service.asmx";

    public string MembershipProviderService { get; set; }
    public string RoleProviderService { get; set; }

Register Config Modules

Config Modules must be registered in Controller.cs-
  1. Add public variable of the same type as the config module
  2. Initialize config module type in the consturctor of Controller.cs
  3. Add config module instance to Sections array in the constructor of Controller.cs

public Controller()
    Links = new Links();
    Email = new Email();
    Sections = new object[] { Links, Email };

public Email Email { get; set; }
public Links Links { get; set; }

Specifying Config Values from Web UI

  1. Navigate to Site Actions menu > Site Settings
  2. Click 'Site Settings' under 'Portal Solutions' group
  3. Modify values for any config modules and press Update


Accessing config properties from code

  1. (Optional) Initialize the controller by passing it a SPWeb object. By default, the root web of the current context's site collection is used
  2. Use the Controller.Current singleton to access registered config modules and their properties

using (var site = new SPSite("http://site"))
using (SPWeb web = site.OpenWeb())
    //Optional initialization. Defaults to SPContext.Current.Site.RootWeb otherwise


Last edited Apr 22, 2012 at 11:33 PM by epranav, version 9


No comments yet.