using
System;
using System.IO;
using System.Data;
using System.Configuration;
using System.Collections;
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;
public partial class getDirectory : System.Web.UI.Page
{
protected void Page_Load( object sender, EventArgs e)
{
string path = Request.QueryString[ " path " ];
if (path == null || path == "" )
path = @" C:\Windows " ;
DirectoryInfo TheFolder = new DirectoryInfo(path);
if ( ! TheFolder.Exists)
throw new DirectoryNotFoundException( " Folder not found: " + path);
string info = " <?xml version=\ " 1.0 \ " ?><tree> " ;
foreach (DirectoryInfo NextFolder in TheFolder.GetDirectories())
{
//判读是否是隐藏文件夹
if (NextFolder.Attributes.ToString().IndexOf( " Hidden " ) == - 1 )
info += " <tree text=\ "" + NextFolder.Name + " \ " src=\ "" + NextFolder.FullName + " \ " /> " ;
}
info += " </tree> " ;
Response.Clear();
Response.ContentType = " text/xml " ;
Response.Charset = " UTF-8 " ;
Response.Write(info);
Response.End();
}
}
using System.IO;
using System.Data;
using System.Configuration;
using System.Collections;
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;
public partial class getDirectory : System.Web.UI.Page
{
protected void Page_Load( object sender, EventArgs e)
{
string path = Request.QueryString[ " path " ];
if (path == null || path == "" )
path = @" C:\Windows " ;
DirectoryInfo TheFolder = new DirectoryInfo(path);
if ( ! TheFolder.Exists)
throw new DirectoryNotFoundException( " Folder not found: " + path);
string info = " <?xml version=\ " 1.0 \ " ?><tree> " ;
foreach (DirectoryInfo NextFolder in TheFolder.GetDirectories())
{
//判读是否是隐藏文件夹
if (NextFolder.Attributes.ToString().IndexOf( " Hidden " ) == - 1 )
info += " <tree text=\ "" + NextFolder.Name + " \ " src=\ "" + NextFolder.FullName + " \ " /> " ;
}
info += " </tree> " ;
Response.Clear();
Response.ContentType = " text/xml " ;
Response.Charset = " UTF-8 " ;
Response.Write(info);
Response.End();
}
}