<form id="hz9zz"></form>
  • <form id="hz9zz"></form>

      <nobr id="hz9zz"></nobr>

      <form id="hz9zz"></form>

    1. 明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

      一個asp+ 版本的 Active Server Explorer

      [摘要]/*豆腐制作 都是精品http://www.asp888.net 豆腐技術站如轉載 請保留版權信息*/很多人可能都用過 chinaAsp 出的 ase 可以對 服務器上的文件進行各種操作,在這里我們...
      /*
      豆腐制作 都是精品
      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 下載
      謝謝大家

      作者:豆腐()





      日韩精品一区二区三区高清