一个asp+ 版本的 Active Server Explorer
点击次数:25 次 发布日期:2008-11-26 23:36:43 作者:源代码网
|
源代码网推荐
/* 源代码网推荐豆腐制作 都是精品 源代码网推荐http://www.asp888.net 豆腐技术站 源代码网推荐如转载 请保留版权信息 源代码网推荐*/ 源代码网推荐很多人可能都用过 chinaAsp 出的 ase 可以对 服务器上的文件进行各种操作,在这里我们也来 源代码网推荐讲一个在 asp plus 下实现 ase 的程序 由于时间仓促 和本来就是 出于 演示的目的 本程序只演示了最简单的 情况 至于 上传 和编辑文本文件 我在 以前的文章里 都已经 讲过了,大家可以到 http://www.asp888.net 查看技术栏目里面的文章 源代码网推荐首先是 列出 机器上 的盘符 源代码网推荐<% @Page Language="C#" %> 源代码网推荐<% @Import Namespace="System.IO" %> 源代码网推荐<% 源代码网推荐string[] LocalDriver = Directory.GetLogicalDrives(); 源代码网推荐int intNum = LocalDriver.Length; 源代码网推荐Response.Write("<ul>"); 源代码网推荐for (int i=0; i < intNum; i++) 源代码网推荐{ 源代码网推荐%> 源代码网推荐<li><a href="dir.aspx?dir=<%=Server.UrlEncode(LocalDriver[i])%>"><%=LocalDriver[i]%></a></li> 源代码网推荐<% 源代码网推荐} 源代码网推荐Response.Write("</ul>"); 源代码网推荐%> 源代码网推荐列出所选择的盘符 上的目录 源代码网推荐<% @Page Language="C#" %> 源代码网推荐<% @Import Namespace="System.IO" %> 源代码网推荐<% 源代码网推荐string strDir2List = Server.UrlDecode(Request.QueryString.Get("dir")); 源代码网推荐Directory thisOne = null; 源代码网推荐try 源代码网推荐{ 源代码网推荐thisOne = new Directory(strDir2List); 源代码网推荐// 得到当前的目录创建时间 源代码网推荐Response.Write("<p>当前所在目录: " + thisOne.ToString() + "</p>"); 源代码网推荐Directory[] Dir = thisOne.GetDirectories(); 源代码网推荐Response.Write("<ul>"); 源代码网推荐for (int i=0; i < Dir.Length; i++) 源代码网推荐{ 源代码网推荐Response.Write("<li><a href="dir.aspx?dir="); 源代码网推荐Response.Write(Server.UrlEncode(Dir[i].FullName)); 源代码网推荐Response.Write("">" + Dir[i].Name); 源代码网推荐Response.Write("</a><br>"); 源代码网推荐} 源代码网推荐Response.Write("</ul>");
File[] Files = thisOne.GetFiles(); 源代码网推荐Response.Write("<ul>"); 源代码网推荐for (int i=0; i < Files.Length; i++) 源代码网推荐{ 源代码网推荐Response.Write("<li><a href="viewfile.aspx?file="); 源代码网推荐Response.Write(Server.UrlEncode(Files[i].FullName)); 源代码网推荐Response.Write("">" + Files[i].Name); 源代码网推荐Response.Write("</a><br>"); 源代码网推荐} 源代码网推荐Response.Write("</ul>"); 源代码网推荐} 源代码网推荐catch (Exception e) 源代码网推荐{ 源代码网推荐Response.Write("错误: <i>"); 源代码网推荐Response.Write(e.ToString() + "</i>"); 源代码网推荐Response.End(); 源代码网推荐} 源代码网推荐%> 源代码网推荐查看文件的详细信息: 源代码网推荐<% @Page Language=VB %> 源代码网推荐<% @Import Namespace="System" %> 源代码网推荐<% @Import Namespace="System.IO" %> 源代码网推荐<html> 源代码网推荐<head><title>编辑文件</title></head> 源代码网推荐<body> 源代码网推荐<% 源代码网推荐dim File as string 源代码网推荐File = Request.QueryString.Get("file") 源代码网推荐thisOne = new File(File) 源代码网推荐"string File = Request.QueryString.Get("file"); 源代码网推荐"File thisOne = new File(File); 源代码网推荐%> 源代码网推荐<table> 源代码网推荐<tr><td>文件名称:</td><td><%=thisOne.Name%></td></tr> 源代码网推荐<tr><td>文件的全名:</td><td><%=thisOne.FullName%></td></tr> 源代码网推荐<tr><td>所在目录:</td><td><%=thisOne.DirectoryName%></td></tr> 源代码网推荐<tr><td>文件创建时间:</td><td><%=thisOne.CreationTime.ToString()%></td></tr> 源代码网推荐<tr><td>文件大小:</td><td><%=thisOne.Length.ToString()%> Bytes</td></tr> 源代码网推荐<tr><td>最近一次的存取时间:</td><td><%=thisOne.LastAccessTime.ToString()%></td></tr> 源代码网推荐<tr><td>最近一次更新时间:</td><td><%=thisOne.LastWriteTime.ToString()%></td></tr> 源代码网推荐</table> 源代码网推荐<% 源代码网推荐ss=split(thisOne.Name,".") 源代码网推荐fileent=lcase(ss(ubound(ss))) 源代码网推荐if fileent="txt" or fileent="asp" or fileent="aspx" then 源代码网推荐theReader = thisOne.OpenText() 源代码网推荐Do 源代码网推荐strIn = theReader.ReadLine() 源代码网推荐response.write(strIn) 源代码网推荐Loop Until strIn = Null
%> 源代码网推荐<form action="savefile.asp" method=post> 源代码网推荐<textarea cols=40 rows=30><%=strIn%></textarea> 源代码网推荐<input type=hidden name=filename value="<%=thisOne.FullName%>"> 源代码网推荐<br> 源代码网推荐<input type=submit value="保存更改"> 源代码网推荐</form>
<% 源代码网推荐end if 源代码网推荐%> 源代码网推荐</body> 源代码网推荐</html> 源代码网推荐好了一个完整的 ase 程序还需要 删除 拷贝 移动和上传 编辑 相信大家在 看完这个程序以后 一定会 有办法 经过 简单 的改动 就 可以实现 源代码网推荐这个程序的完整例子可以在 http://www.asp888.net/download/asp/ase.zip 下载 源代码网推荐谢谢大家
作者:豆腐()
源代码网供稿. |