当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 一个asp+ 版本的 Active Server Explorer

ASP.NET
FreeTextBox(版本3.1.6)在ASP.Net 2.0中使用方法
.NET 常用功能和代码小结
在 .NET Framework 2.0 中未处理的异常导致基于 ASP.NET 的应用程序意外退出
asp.net IList查询数据后格式化数据再绑定控件
asp.net sql存储过程
asp.net 简单实现禁用或启用页面中的某一类型的控件
asp.net(c#)获取内容第一张图片地址的函数
The remote procedure call failed and did not execute的解决办法
ASP.NET 在线文件管理
asp.net 读取并修改config文件实现代码
ASP.NET Cookie 操作实现
asp.net Silverlight中的模式窗体
Silverlight中动态获取Web Service地址
asp.net Silverlight应用程序中获取载体aspx页面参数
asp.net 水晶报表隔行换色实现方法
asp.net 获取Gridview隐藏列的值
手动把asp.net的类生成dll文件的方法
asp.net 使用ObjectDataSource控件在ASP.NET中实现Ajax真分页
动态指定任意类型的ObjectDataSource对象的查询参数
asp.net Md5的用法小结

ASP.NET 中的 一个asp+ 版本的 Active Server Explorer


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 50 ::
收藏到网摘: n/a

/*
豆腐制作 都是精品
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 程序还需要 删除 拷贝 移动和