This project is read-only.

WebConfigManager

Utility class that handles updates to web.config inside SharePoint. The class accepts XDocuments or SPFeaureReceiverProperties (with a web.config inside the feature).
To use it inside a feature add a web.config file with your configurations and use the code below. No more writing complicated code to add web.config changes.
A full explanation and example of how to use this class can be seen in my blog.

Here´s an example of how to use it inside a feature:
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
            using (WebConfigManager mgr = new WebConfigManager(properties))
            {
                mgr.Logging+= (sender, args) => log.Write(args.Value);
                try
                {
                    mgr.ApplyChanges();
                    mgr.Commit();
                }
                catch (Exception e)
                {
                    log.WriteException(e, "An error occured when applying web.config changes.");
                }
            }
}

Last edited Feb 17, 2010 at 4:02 PM by jole, version 5

Comments

No comments yet.