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>
* 使用示列:
相关文档:
验证码页面后台Code.aspx.cs代码:(已经将验证码存于session中session["code"],可在调用页面直接读取session)
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.WebCon ......
在使用asp.net编写webservice时,默认情况下是不支持session的,但我们可以把WebMethod的EnableSession选项设为true来显式的打开它,请看以下例子:
1 新建网站WebSite
2 新建web服务WebService.asmx,它具有以下两个方法:
[WebMethod(EnableSession = true)]
public string Login(string name)
{
  ......
是否厌倦了用xml文件来做Magento的页面布局,是的话来试试下面这种方式,把布局代码写到controller 里面
public function mycoolAction()
{
/* ... Some code ...*/
$update = $this->getLayout()->getUpdate();
/* ... Some code ...*/
$this->addActionLayoutHandles();
/* ... Some code ...*/
......
前面文章中提到 xml节点的删除
“删除 <book genre="fantasy" ISBN="2-3631-4">节点的genre属性,删除 <book genre="update陶维佳" ISBN="2-3631-4">节点。”
代码:
XmlNodeList xnl=xmlDoc.SelectSingleNode("bookstore").ChildNodes;
foreach(XmlNode&nbs ......
IIS 7 默认文件上传大小时30M
要突破这个限制:
1. 修改IIS的applicationhost.config
打开 %windir%\system32\inetsrv\config\applicationhost.config
找到: <requestFiltering>节点,
这个节点默认没有 <requestLimits maxAllowedContentLength="上传 ......