读取目录列表
来源:互联网 发布:程序员自由职业 编辑:程序博客网 时间:2024/04/30 08:23
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="gb2312" %>
<%@Import Namespace="System.IO"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ListDrives</title>
</head>
<%
string[] achDrives=Directory.GetLogicalDrives();
int nNumOfDrives=achDrives.Length;
Response.Write("<ul>");
for(int i=0; i<nNumOfDrives; i++)
{
Response.Write("<li><a href=/"listdir.aspx?dir=");
Response.Write(Server.UrlEncode(achDrives[i]));
Response.Write("/">"+achDrives[i]);
Response.Write("</a><br>");
}
Response.Write("</ul>");
%>
<body>
</body>
</html>
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="gb2312" %>
<%@Import Namespace="System.IO" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>listdir</title>
</head>
<%
string strDir2List=Request.QueryString.Get("dir");
DirectoryInfo thisOne=null;
try
{
thisOne=new DirectoryInfo(strDir2List);
Response.Write("<p>Creation:"+thisOne.CreationTime.ToString()+"<p>");
DirectoryInfo[] subDirectories=thisOne.GetDirectories();
Response.Write("<ul>");
for(int i=0; i<subDirectories.Length; i++)
{
Response.Write("<li><a href=/"listdir.aspx?dir=");
Response.Write(Server.UrlEncode(subDirectories[i].FullName));
Response.Write("/">"+subDirectories[i].Name);
Response.Write("</a><br>");
}
Response.Write("</ul>");
FileInfo[] theFiles=thisOne.GetFiles();
Response.Write("<ul>");
for(int i=0; i<theFiles.Length;i++)
{
Response.Write("<li><a href=/"showfiles.aspx?file=");
Response.Write(Server.UrlEncode(theFiles[i].FullName));
Response.Write("/">"+theFiles[i].Name);
Response.Write("</a><br>");
}
Response.Write("</ul>");
}
catch(Exception e)
{
Response.Write("Access not possible, error:<i>");
Response.Write(e.ToString()+"</i>");
Response.End();
}
%>
<body>
</body>
</html>
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="gb2312" %>
<% @Import Namespace="System.IO"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>showfiels</title>
</head>
<body>
<%
string strFile2Show=Request.QueryString.Get("file");
FileInfo thisOne=new FileInfo(strFile2Show);
%>
<table>
<tr><td>Name:</td><td><%=thisOne.Name%></td></tr>
<tr><td>Path:</td><td><%=thisOne.FullName%></td></tr>
<tr><td>Directory:</td><td><%=thisOne.DirectoryName%></td></tr>
<tr>
<td>Date Created:</td>
</tr>
<tr>
<td>Size:</td>
<td><%=thisOne.Length.ToString()%>Bytes</td>
</tr>
<tr>
<td>Last access:</td>
<td><%=thisOne.LastAccessTime.ToString()%></td>
</tr>
<tr>
<td>Last modified:</td>
<td><%=thisOne.LastWriteTime.ToString()%></td>
</tr>
</table>
<%
StreamReader theReader=thisOne.OpenText();
char[]theBuffer=new char[255];
int nRead=theReader.ReadBlock(theBuffer,0,255);
Response.Write("<pre>");
Response.Write(Server.HtmlEncode(new string(theBuffer,0,nRead)));
Response.Write("</pre>");
%>
</body>
</html>
- 读取目录列表
- ftp 读取目录列表失败
- FileZilla读取目录列表失败
- 读取目录下的文件列表
- ftp连接:读取目录列表失败
- pureftp读取目录列表失败解决
- pureftp 读取目录列表失败解决办法
- ftp连接:读取目录列表失败
- FileZilla读取目录列表失败的解决办法
- php读取目录生成文件列表
- vsftpd 读取目录列表失败的问题
- Java 使用iText读取PDF文档目录列表(zz)
- FileZilla读取目录列表失败的解决办法 ftp
- Android 读取目录中的文件列表并展示
- 解决vsftpd 读取目录列表失败的问题
- linux 下读取文件目录下名字列表
- 解决vsftpd 2.2.2读取目录列表失败的问题
- 目录列表
- asp和HTML表单
- 食用生香蕉的皮可以抵抗忧郁--健康--人民网
- 爱情故事
- 俞敏洪在北大开学典礼上的演讲[转帖]
- Java对象序列化
- 读取目录列表
- 小白兔冷笑话大全
- Google 10岁生日!(200多个google特色Logo)
- asp.net连接数据库
- 组合的算法
- fileupload控件:UpdatePanel中FileUpload控件应用问题
- 你的合作伙伴在哪里?--管理软件夜未眠(六)
- 组合的算法(二)
- 应用系统架构设计