PC6下载站

分类分类

查看服务器磁盘、文件的aspx.

关注+2004-11-07作者:蓝点

listdrives.aspx



<% page="" language="C#">

<% import="" namespace="System">

<% import="" namespace="System.IO">



<%

string qdrives = Environment.OSVersion.ToString();

string qnewline=Environment.SystemDirectory.ToString();

string qmo=Environment.WorkingSet.ToString();

int qtick=Environment.TickCount;

qtick/=60000;

string[] achDrives = Directory.GetLogicalDrives();

int nNumOfDrives = achDrives.Length;

Response.Write("您的系统是:");

Response.Write(qdrives);

Response.Write("
");

Response.Write("您的可用内存是:");

Response.Write(qmo);

Response.Write("
");

Response.Write("自上次重启已经有");

Response.Write(qtick.ToString());

Response.Write("分钟了");

Response.Write("
");

Response.Write("
");

Response.Write("
");

Response.Write("查看你的磁盘:");



Response.Write("

");


for (int i=0; i < nNumOfDrives; i++)


{


    Response.Write("

<a href=\"listdir.aspx?dir=");

    Response.Write(Server.UrlEncode(achDrives[i]));

    Response.Write("\">" + achDrives[i]);

    Response.Write("
");

}

Response.Write("

");

%>





listdir.aspx





<% page="" language="C#" debug="true">

<% import="" namespace="System.IO">

<%

string strDir2List = Request.QueryString.Get("dir");

Directory thisOne = null;



try

{

    thisOne = new Directory(strDir2List);

    // Auslesen der Eigenschaften der Verzeichnisses

    Response.Write("

创建时间: " + thisOne.CreationTime.ToString() + "

");

        Directory[] subDirectories = thisOne.GetDirectories();

    Response.Write("

");


    Response.Write("-------------------------------文件夹-------------------------");


    Response.Write("

 

");


    for (int i=0; i < subDirectories.Length; i++)


    {


        Response.Write("

<a href=\"listdir.aspx?dir=");

        Response.Write(Server.UrlEncode(subDirectories[i].FullName));

        Response.Write("\">" + subDirectories[i].Name);

        Response.Write("
");

    }

    Response.Write("

");

    

    File[] theFiles = thisOne.GetFiles();

    Response.Write("

");


    Response.Write("-------------------------------文件----------------------------");


    Response.Write("

 

");


    for (int i=0; i < theFiles.Length; i++)


    {


        Response.Write("

<a href=\"showfile.aspx?file=");

        Response.Write(Server.UrlEncode(theFiles[i].FullName));

        Response.Write("\">" + theFiles[i].Name);

        Response.Write("
");

    }

    Response.Write("

");

}

catch (Exception e)

{

    Response.Write("由于以下原因无法实现此功能: ");

    Response.Write(e.ToString() + "");

    Response.End();

}

%>





showfile.aspx





<% page="" language="C#" debug="true">

<% import="" namespace="System.IO">


File Info





<%

string strFile2Show = Request.QueryString.Get("file");

File thisOne = new File(strFile2Show);

%>














文件名:
<%=thisone.name%>
全名:
<%=thisone.fullname%>
文件创建日期:
<%=thisone.creationtime.tostring()%>
文件大小:
<%=thisone.length.tostring()%> Bytes
上次使用时间:
<%=thisone.lastaccesstime.tostring()%>
上次修改时间:
<%=thisone.lastwritetime.tostring()%>





<%

StreamReader theReader = thisOne.OpenText();

char[] theBuffer = new char[1000];

int nRead = theReader.ReadBlock(theBuffer, 0, 1000);

Response.Write("
");

Response.Write(" 文件内容预览:");

Response.Write("
");

Response.Write("

 

"); Response.Write(Server.HtmlEncode(new String(theBuffer,0,nRead))); Response.Write("

 

");

%>









正在丰富成管理用,整合上传,修改,删除等管理功能

不知有没有这么多时间了

努力吧,朋友

展开全部

相关文章

更多+相同厂商

热门推荐

  • 最新排行
  • 最热排行
  • 评分最高
排行榜

    点击查看更多

      点击查看更多

        点击查看更多

        说两句网友评论

          我要评论...
          取消