改写web.config
来源:互联网 发布:淘宝网 腰带 编辑:程序博客网 时间:2024/04/30 00:45
public override void Install(System.Collections.IDictionary stateSaver)
{
try
{
FileInfo myFileInfo=new FileInfo(this.Context.Parameters["targetdir"]+@"/Web.config");
if (!myFileInfo.Exists)
{
throw new InstallException("No find the web.config");
}
XmlDocument myXmlDocument=new XmlDocument();
myXmlDocument.Load(myFileInfo.FullName);
//search the appSetting Node
bool FoundIt;
FoundIt=false;
foreach (XmlNode myNode in myXmlDocument["configuration"]["appSettings"])
{
if (myNode.Name=="add")
{
if (myNode.Attributes.GetNamedItem("key").Value=="ConnectionString")
{
myNode.Attributes.GetNamedItem("value").Value=String.Format("server={0};database={1};uid={2};pwd={3}",this.Context.Parameters["server"],this.Context.Parameters["dbname"],this.Context.Parameters["user"],this.Context.Parameters["pwd"]);
FoundIt=true;
}
}
}
if(FoundIt==false)
{
throw new InstallException("web.Config not inculding ConnectionString");
}
myXmlDocument.Save(myFileInfo.FullName);
}
catch(Exception ex)
{
throw ex;
}
}
- 改写web.config
- web.config
- web.config
- web.config
- web.config
- WEB.CONFIG
- web.config
- web.config
- web.config
- Web.config
- web.config
- web.config
- web.config
- web.config
- web.config
- Web.config
- web.config
- WEB.CONFIG
- c语言文件操作
- XML 安全: 实现安全层,第 2 部分
- 在C#程序中实现插件架构
- 更好的使用.net 2.0中的枚举类型
- 通用搜索引擎的垂直化倾向
- 改写web.config
- 用GHOST8.0分区备份、恢复详细图解
- Xen虚拟技术的发展现状与红帽集成情况
- 经典转贴:想成为嵌入式程序员应知道的0x10个基本问题
- 陈绍华 - 全世界最伤心的人
- CSDN博客
- 2006.05.27,p264decoder开始发布!
- 中国人聪明吗?
- A 'C' Test: The 0x10 Best Questions for Would-be Embedded Programmers