Asp.net控件开发-如何给控件添加自动配置web.Config文件的功能
原文地址:http://www.antardev.cn/showArticle.aspx?id=107 转载请注明出处
IWebApplication webapp = (IWebApplication)Component.Site.GetService(typeof(IWebApplication));
System.Configuration.Configuration cf = webapp.OpenWebConfiguration(false);
System.Web.Configuration.HttpModulesSection hts = cf.GetSection("system.web/httpModules") as System.Web.Configuration.HttpModulesSection;
bool flag = false;
for (int i = 0; i < hts.Modules.Count; i++)
if (hts.Modules[i].Type.ToLower() == "AntarDev.ProgressBarHttpModule".ToLower())
{
flag = true;
break;
}
if (!flag)
hts.Modules.Add(new HttpModuleAction("AntarDev.ProgressBar", "AntarDev.ProgressBarHttpModule"));
cf.Save();
}
原文地址:http://www.antardev.cn/showArticle.aspx?id=107 转载请注明出处
posted on 2009-02-26 23:30 bingdian3721 阅读(467) 评论(0) 编辑 收藏