home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 February
/
CHIP_2_98.iso
/
software
/
pelne
/
optionp
/
iis4_07.cab
/
FileSystem_JScript.asp
< prev
next >
Wrap
Text File
|
1997-10-25
|
1KB
|
56 lines
<% @Language=JScript %>
<%
// Define Constants
ForReading = 1;
ForWriting = 2;
ForAppending = 8;
%>
<HTML>
<HEAD>
<TITLE>FileSystem Component</TITLE>
</HEAD>
<BODY bgcolor="white" topmargin="10" leftmargin="10">
<!-- Display Header -->
<font size="4" face="Arial, Helvetica">
<b>FileSystem Component</b></font><br>
<hr size="1" color="#000000">
<%
// Map current path to physical path
curDir = Server.MapPath("\\iissamples\\sdk\\asp\\components\\");
// Create FileSytemObject Component
ScriptObject = Server.CreateObject("Scripting.FileSystemObject");
// Create and Write to a File
MyFile = ScriptObject.CreateTextFile(curDir + "\\" + "MyTextFile.txt", ForWriting);
for (x = 1; x < 5; x++)
{
MyFile.WriteLine("Line number " + x + " was written to MyTextFile.txt <br>");
}
MyFile.Close();
%>
<%
// Read From File and Output to Screen
MyFile = ScriptObject.OpenTextFile(curDir + "\\" + "MyTextFile.txt", ForReading);
Response.Write(MyFile.ReadAll());
MyFile.Close();
%>
</BODY>
</HTML>