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

ASP.NET
asp.net GridView控件中模板列CheckBox全选、反选、取消
asp.net GridView 删除时弹出确认对话框(包括内容提示)
asp.net DropDownList 三级联动下拉菜单实现代码
asp DataTable添加列和行的三种方法
Asp.net 页面调用javascript变量的值
asp.net 长文章通过设定的行数分页
asp.net 定时间点执行任务的简易解决办法
asp.net 页面延时五秒,跳转到另外的页面
asp.net 动态输出透明gif图片
asp.net DataList与Repeater用法区别
asp.net Javascript获取CheckBoxList的value
asp.net程序在调式和发布之间图片路径问题的解决方法
asp.net下生成英文字符数字验证码的代码
asp.net 页面版文本框智能提示JSCode (升级版)
ASP.NET URL伪静态重写实现方法
ASP.NET 2.0 中Forms安全认证
asp.net 动态添加多个用户控件
asp.net Repeater显示父子表数据,无闪烁
asp.net 无法获取的内部内容,因为该内容不是文本 的解决方法
asp.net GridView排序简单实现

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 41 ::
收藏到网摘: 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 程序还需要 删除 拷贝 移动和