sample.aspx
=====================================================
<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%
Context.Response.ContentType = "text/plain";
DirectoryInfo[] cDirs = new DirectoryInfo(@"D:\").GetDirectories();
StreamWriter sw = new StreamWriter("D:/CDriveDirs.txt", true);
foreach (DirectoryInfo dir in cDirs)
{
sw.WriteLine(dir.Name);
sw.WriteLine("\n");
Response.Write(dir.Name);
Response.Write("\n");
}
sw.Flush();
sw.Close();
%>
=====================================================
<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%
Context.Response.ContentType = "text/plain";
DirectoryInfo[] cDirs = new DirectoryInfo(@"D:\").GetDirectories();
StreamReader sr = new StreamReader("D:/CDriveDirs.txt");
String line;
while((line=sr.ReadLine())!=null)
{
Response.Write(line+"\n");
}
sr.Close();
%>
=====================================================
<%@ Page Language="C#" %>
<%@ Import Namespace="System.IO" %>
<%
Context.Response.ContentType = "text/plain";
DirectoryInfo[] cDirs = new DirectoryInfo(@"D:\").GetDirectories();
StreamReader sr = new StreamReader("D:/CDriveDirs.txt");
String line;
while((line=sr.ReadLine())!=null)
{
Response.Write(line+"\n");
}
sr.Close();
%>