Asp.Net XML操作基类
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using System.Xml;
using System.Text;
using MSXML2;
namespace EC
{
/// <summary>
/// XML 操作基类
/// </summary>
public class XmlObject : IDisposable
{
//以下为单一功能的静态类
#region 读取XML到DataSet
/**************************************************
* 函数名称:GetXml(string XmlPath)
* 功能说明:读取XML到DataSet
* 参 数:XmlPath:xml文档路径
* 使用示列:
* using EC; //引用命名空间
* string xmlPath = Server.MapPath("/EBDnsConfig/DnsConfig.xml"); //获取xml路径
* DataSet ds = EC.XmlObject.GetXml(xmlPath); //读取xml到DataSet中
************************************************/
/// <summary>
/// 功能:读取XML到DataSet中
/// </summary>
/// <param name="XmlPath">xml路径</param>
/// <returns>DataSet</returns>
public static DataSet GetXml(string XmlPath)
{
DataSet ds = new DataSet();
ds.ReadXml(@XmlPath);
return ds;
}
#endregion
#region 读取xml文档并返回一个节点
/**************************************************
* 函数名称:ReadXmlReturnNode(string XmlPath,string Node)
* 功能说明:读取xml文档并返回一个节点:适用于一级节点
* 参 数: XmlPath:xml文档路径;Node 返回的节点名称
* 适应用Xml:<?xml version="1.0" encoding="utf-8" ?>
* <root>
* <dns1>ns1.everdns.com</dns1>
* </root>
* 使用示列:
相关文档:
不要使用不必要的Session,和ASP中一样,在不必要的时候不要使用Session
不使用不必要的Server Control
不使用不必要的ViewState
不要用Exception控制程序流程
禁用VB和Jscript动态数据类型
使用存储过程完成数据访问
只读数据访问不要使用DataSet
关闭ASP.N ......
我们在首次部署mvc的项目时通常会遇到一点问题。M$已经在Global.asax.cs文件中包含了这两句注释的提示。
// Note: For instructions on enabling IIS6 or IIS7 classic mode,
// visit http://go.microsoft.com/?LinkId=9394801
但是我们访问这个网址看到上面的文章对iis5.1(win ......
String.IndexOf 方法 (value, [startIndex], [count])
报告指定字符在此实例中的第一个匹配项的索引。搜索从指定字符位置开始,并检查指定数量的字符位置。
参数
value
要查找的 Unicode 字符。 对 value 的搜索区分大小写。
startIndex(Int32)
可选项,搜索起始位置。不设置则从0开始。
......