public static void SetValue(string key, string value) { Configuration config = WebConfigurationManager.OpenWebConfiguration("~/xml/"); //ConnectionStringSettings test = new ConnectionStringSettings("test1", "test1", "test1.dll"); //config.ConnectionStrings.ConnectionStrings.Add(test); //<add src="~/WebPart/ProductCate.ascx" tagName="cate" tagPrefix="uc" /> TagPrefixInfo dd = new TagPrefixInfo("uc", "", "", "cate", "~/WebPart/ProductCate.ascx"); //config.SectionGroups["system.web"] SystemWebSectionGroup t = new SystemWebSectionGroup(); t.Pages.Controls.Add(dd); config.Save(ConfigurationSaveMode.Modified); }
void AddControl(PagesSection section, SettingsMappingWhatContents how) { Dictionary <string, string> attrs = how.Attributes; if (attrs == null || attrs.Count == 0) { return; } string tagPrefix, nameSpace, asm, tagName, source; if (!attrs.TryGetValue("tagPrefix", out tagPrefix)) { tagPrefix = String.Empty; } if (!attrs.TryGetValue("namespace", out nameSpace)) { nameSpace = String.Empty; } if (!attrs.TryGetValue("assembly", out asm)) { asm = String.Empty; } if (!attrs.TryGetValue("tagName", out tagName)) { tagName = String.Empty; } if (!attrs.TryGetValue("src", out source)) { source = String.Empty; } TagPrefixInfo info = new TagPrefixInfo(tagPrefix, nameSpace, asm, tagName, source); section.Controls.Add(info); }
// Methods public void Add(TagPrefixInfo tagPrefixInformation) { }
public void Remove(TagPrefixInfo tagPrefixInformation) { }