asp.net 对 xml webconfig的操作
2008-06-25 22:54
405 查看
XmlDocument xdc = new XmlDocument();
xdc.Load(Server.MapPath("Web.config"));
XmlNode root = xdc.SelectSingleNode("configuration/appSettings/add");
XmlElement xe = root as XmlElement;
xe.SetAttribute("value","server=.;database=pubs;user id=sa;password=");
xe.InnerText="tesstadd";
xdc.Save(Server.MapPath("Web.config"));
Response.Write(xe.GetAttribute("key"));
Dim xdc As XmlDocument = New XmlDocument
xdc.Load(Request.PhysicalApplicationPath + ("web.xml"))
Dim xn As XmlNode = xdc.SelectSingleNode("root/config/pc")
Dim xe As XmlElement = CType(xn, XmlElement)
xe.GetAttribute("name")
xe.GetAttribute("ip")
xe.GetAttribute("open")
Dim ip As String = xe.GetAttribute("ip")
Dim open As String = xe.GetAttribute("open")
If open = "yes" Then
Else
Response.Redirect(Request.Url.ToString())
End If
xdc.Load(Server.MapPath("Web.config"));
XmlNode root = xdc.SelectSingleNode("configuration/appSettings/add");
XmlElement xe = root as XmlElement;
xe.SetAttribute("value","server=.;database=pubs;user id=sa;password=");
xe.InnerText="tesstadd";
xdc.Save(Server.MapPath("Web.config"));
Response.Write(xe.GetAttribute("key"));
Dim xdc As XmlDocument = New XmlDocument
xdc.Load(Request.PhysicalApplicationPath + ("web.xml"))
Dim xn As XmlNode = xdc.SelectSingleNode("root/config/pc")
Dim xe As XmlElement = CType(xn, XmlElement)
xe.GetAttribute("name")
xe.GetAttribute("ip")
xe.GetAttribute("open")
Dim ip As String = xe.GetAttribute("ip")
Dim open As String = xe.GetAttribute("open")
If open = "yes" Then
Else
Response.Redirect(Request.Url.ToString())
End If
相关文章推荐
- ASP.NET修改Web.Config文件(对xml的操作)
- asp.net 对 xml webconfig的操作
- C#/ASP.NET应用程序配置文件app.config/web.config的增、删、改操作
- 转:Manage Web.config from XML File by using configSource attribute ASP.Net 2.0
- C#/ASP.NET应用程序配置文件app.config/web.config的增、删、改操作
- C#/ASP.NET应用程序配置文件app.config/web.config的增、删、改操作
- C#/ASP.NET应用程序配置文件app.config/web.config的增、删、改操作
- 关于C#和ASP.NET中对App.config和Web.config文件里的[appSettings]和[connectionStrings]节点进行新增、修改、删除和读取相关的操作
- C#/ASP.NET应用程序配置文件app.config/web.config的增、删、改操作,无法为请求的 Configuration 对象创建配置文件。
- 关于C#和ASP.NET中对App.config和Web.config文件里的[appSettings]和[connectionStrings]节点进行新增、修改、删除和读取相关的操作
- C#/ASP.NET应用程序配置文件app.config/web.config的增、删、改操作
- C#/ASP.NET应用程序配置文件app.config/web.config的增、删、改操作
- 关于C#和ASP.NET中对App.config和Web.config文件里的[appSettings]和[connectionStrings]节点进行新增、修改、删除和读取相关的操作
- ASP.NET(C#)应用程序配置文件app.config/web.config的增、删、改操作
- C#/ASP.NET应用程序配置文件app.config/web.config的增、删、改操作
- C#/ASP.NET应用程序配置文件app.config/web.config的增、删、改操作
- asp.net mvc webconfig配置文件操作
- 关于C#和ASP.NET中对App.config和Web.config文件里的[appSettings]和[connectionStrings]节点进行新增、修改、删除和读取相关的操作
- C#/ASP.NET应用程序配置文件app.config/web.config的增、删、改操作
- C#/ASP.NET应用程序配置文件app.config/web.config的增、删、改操作