1var newMaster = properties.Feature.Properties["MasterName"].Value;
2
3 if (!string.IsNullOrEmpty(newMaster))
4 {
5 using (var curSite = (SPSite)properties.Feature.Parent)
6 {
7 using (var curWeb = curSite.OpenWeb(""))
8 {
9 //got the current site and root web in site, now set the master Url
10 //to our master page that should have been uploaded as part
11 //of our feature
12 if (curWeb.MasterUrl.Contains("default.master"))
13 {
14 curWeb.MasterUrl = curWeb.MasterUrl.Replace("default.master", newMaster);
15 curWeb.Update();
16 UpdateLog("MasterUrl property updated for web " + curWeb.Title,
17 EventLogEntryType.Information);
18 }
19
20 }
21 }
22 }