home *** CD-ROM | disk | FTP | other *** search
/ Chip 1999 September / CHIPCD_9_99.iso / software / uaktualnienia / OptionPackPL / iis4_07.cab / FileSystem_VBScript.asp < prev    next >
Text File  |  1998-04-27  |  1KB  |  54 lines

  1. <% @Language=VBScript    %>
  2.  
  3.  
  4. <%
  5.     ' Define Constants
  6.  
  7.     ForReading   = 1
  8.     ForWriting   = 2
  9.     ForAppending = 8
  10. %>
  11.  
  12.  
  13. <HTML>
  14.     <HEAD>
  15.         <TITLE>FileSystem Component</TITLE>
  16.     </HEAD>
  17.  
  18.     <BODY bgcolor="white" topmargin="10" leftmargin="10">
  19.         
  20.         <!-- Display Header -->
  21.  
  22.         <font size="4" face="Arial, Helvetica">
  23.         <b>FileSystem Component</b></font><br>   
  24.  
  25.         <hr size="1" color="#000000">
  26.  
  27.  
  28.         <%
  29.             ' Map current path to physical path
  30.             curDir = Server.MapPath("\iissamples\sdk\asp\components\")
  31.  
  32.  
  33.             ' Create FileSytemObject Component
  34.             Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
  35.  
  36.  
  37.             ' Create and Write to a File
  38.             Set MyFile = ScriptObject.CreateTextFile(curDir + "\" + "MyTextFile.txt", ForWriting)
  39.             
  40.             For x = 1 to 5
  41.                 MyFile.WriteLine "Line number " & x & " was written on " & now & "<br>"
  42.             Next
  43.             
  44.             Myfile.Close
  45.         %>
  46.         
  47.         <%
  48.             ' Read From File and Output to Screen
  49.             Set MyFile = ScriptObject.OpenTextFile(curDir + "\" + "MyTextFile.txt", ForReading)
  50.             Response.Write MyFile.ReadAll
  51.         %>
  52.  
  53.     </BODY>
  54. </HTML>