---------------------------------------服务器端配置--------------
public class DirectoryHttpHandle:IHttpHandler
{
public DirectoryHttpHandle()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
#region IHttpHandler 成员
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
string dirId = context.Request.QueryString["DirID"];
string dirType = context.Request.QueryString["DirType"];
context.Response.Clear();
/* var d1=new directoryInfo(1,"考试",0,1,1);
var d10=new directoryInfo(2,"刑法",1,1,2);
var d201=new directoryInfo(21,"x1",2,1,3);
var d202=new directoryInfo(22,"x2",2,2,3);
var c01=new directoryInfo(220,"xc1",22,1,4);
var c02=new directoryInfo(221,"xc2",22,2,4);
var c03=new directoryInfo(222,"xc3",22,3,4);
var d203=new directoryInfo(23,"x3",2,3,3);
var d11=new directoryInfo(3,"民法",1,2,2);
var d301=new directoryInfo(31,"m1",3,1,3);
var d302=new directoryInfo(32,"m2",3,2,3);
var d303=new directoryInfo(33,"m3",3,3,3);
var d12=new directoryInfo(4,"商法",1,3,2);
var d401=new directoryInfo(41,"s1",4,1,3);
var d402=new directoryInfo(42,"s2",4,2,3);
var d403=new directoryInfo(43,"s3",4,3,3);*/
DirectoryInfo[] dris = new DirectoryInfo[]{
new DirectoryInfo(1, "考试",0,1,1),
new DirectoryInfo(2,"刑法",1,2),
new DirectoryInfo(21,"刑法 & 第一章",2,1),
new DirectoryInfo(22,"刑法第二章",2,2),
new DirectoryInfo(221,"第二章第1节",22,1),
new DirectoryInfo(222,"第二章第2节",22,2),
new DirectoryInfo(223,"第二章第3节",22,3),
new DirectoryInfo(23,"刑法第三章",2,3),
new DirectoryInfo(3,"明法",1,3),
new DirectoryInfo(31,"明法第一章",3,1),
new DirectoryInfo(32,"明法第二章",3,2),
new DirectoryInfo(33,"明法第三章",3,3),
new DirectoryInfo(4,"商法",1,4),
new DirectoryInfo(41,"商法第一章",4,1),
new DirectoryInfo(42,"商法第二章",4,2),
new DirectoryInfo(43,"商法第三章",4,3),
new DirectoryInfo(100, "律师考试",0,2,1),
new DirectoryInfo(10002,"大律师法",100,1),
new DirectoryInfo(100001,"律师法第一章",10002,1),
new DirectoryInfo(100002,"律师法第二章",10002,2),
new DirectoryInfo(10003,"中级律师",100,1)
};
foreach (DirectoryInfo dir in dris)
{
context.Response.Write(dir.DirId);
context.Response.Write(",");
context.Response.Write(dir.DirName.Trim(new char[] { ',', ';' }));
context.Response.Write(",");
context.Response.Write(dir.ParentId);
context.Response.Write(",");
context.Response.Write(dir.OrderId);
context.Response.Write(",");
context.Response.Write(dir.IsTop);
context.Response.Write(";");
}
context.Response.Flush();
context.Response.End();
}
#endregion
}
public class DirectoryInfo
{
public int DirId;
public string DirName;
public int Level;
public int ParentId;
public int OrderId;
public int IsTop;
public DirectoryInfo(int dirId, string dirName, int pId, int order,int isTop)
{
DirId = dirId;
DirName = dirName;
Level = 0;
ParentId = pId;
OrderId = order;
IsTop = isTop;
}
public DirectoryInfo(int dirId, string dirName, int pId, int order)
: this(dirId, dirName, pId, order, 0)
{
}
}