Tutorials to .com


ASP.NET Development Articles


Can't Find What You're Looking For?

Tutorials to .com » Dotnet » Development » An asp + version of the Active Server Explorer

An asp + version of the Active Server Explorer

Print View , by: iSee ,Total views: 13 ,Word Count: 1328 ,Date: Wed, 26 Aug 2009 Time: 4:07 PM

/ *
Tofu is fine
technical points such as tofu reproduced http://www.asp888.net Please keep copyright information
* /
Many people may have used chinaAsp out ase can file on the server for various operations, where we are in terms of a asp plus achieve ase program due to time constraints, and has always been for the purpose of this program is only demonstration demonstrate the most simplest case As for the uploading and editing text files in my previous article have been talked about, we can go to http://www.asp888.net see technical part inside the article first is to list the machine letter
<% @ 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 )%>"><%= LocalDriver%> </ a> </ li>
"%
)
Response.Write ( "</ ul>");
% "
Selected are listed in a directory on the drive letter
<% @ Page Language = "C #"%>
<% @ Import Namespace = "System.IO"%>
"%
string strDir2List = Server.UrlDecode (Request.QueryString.Get ( "dir"));
Directory thisOne = null;
try
(
thisOne = new Directory (strDir2List);
/ / Get the current directory creation time
Response.Write ( "<p> current directory:" + 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. FullName));
Response.Write ("">" + Dir. 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. FullName));
Response.Write ("">" + Files. Name);
Response.Write ( "</ a> <br>");
)
Response.Write ( "</ ul>");
)
catch (Exception e)
(
Response.Write ( "Error: <i>");
Response.Write (e.ToString () + "</ i>");
Response.End ();
)
% "
View the file details:
<% @ Page Language = VB%>
<% @ Import Namespace = "System"%>
<% @ Import Namespace = "System.IO"%>
<html>
<head> <title> edit the file </ 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> File Name: </ td> <td> <% = thisOne.Name%> </ td> </ tr>
<tr> <td> the file's full name: </ td> <td> <% = thisOne.FullName%> </ td> </ tr>
<tr> <td> directory: </ td> <td> <% = thisOne.DirectoryName%> </ td> </ tr>
<tr> <td> file creation time: </ td> <td> <% = thisOne.CreationTime.ToString ()%></ td> </ tr>
<tr> <td> File Size: </ td> <td> <% = thisOne.Length.ToString ()%> Bytes </ td> </ tr>
<tr> <td> last access time: </ td> <td> <% = thisOne.LastAccessTime.ToString ()%></ td> </ tr>
<tr> <td> last updated: </ 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>
Well a complete ase program also need to remove the copy move and upload editors believe that, in the future there will certainly be watching this program through a simple change in approach can be achieved a complete example of this process can be http://www.asp888. net / download / asp / ase.zip download Thank you

Author: tofu ()


Google
 

Rating: Not yet rated

Comments

No comments posted.