% @Language=VBScript %>
<%
' Define Constants
ForReading = 1
ForWriting = 2
ForAppending = 8
%>
FileSystem Component
FileSystem Component
<%
' Map current path to physical path
curDir = Server.MapPath("\iissamples\sdk\asp\components\")
' Create FileSytemObject Component
Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
' Create and Write to a File
Set MyFile = ScriptObject.CreateTextFile(curDir + "\" + "MyTextFile.txt", ForWriting)
For x = 1 to 5
MyFile.WriteLine "Line number " & x & " was written on " & now & "
"
Next
Myfile.Close
%>
<%
' Read From File and Output to Screen
Set MyFile = ScriptObject.OpenTextFile(curDir + "\" + "MyTextFile.txt", ForReading)
Response.Write MyFile.ReadAll
%>