This browser does not support basic Web standards, preventing the display of our site's intended design. May we suggest that you upgrade your browser?

Web Development Code Library ASPFile System Object - Read File

File System Object - Read File

Use the File System Object to read data in from a file. Will loop through the contents of the file one line at a time

<%

Dim path, ForRead

' create the fso object
set fso = Server.Createobject("Scripting.FileSystemObject")
path = "c:\temp\test.txt"
ForRead = 1



' open the file

set file = fso.opentextfile(path, ForRead) 

do until file.AtEndOfStream

        Response.write("Name: " & file.ReadLine & " ")
        Response.write("Home Page: " & file.ReadLine & " ")
        Response.write("Email: " & file.ReadLine & "<p>")

loop

' close and clean up

file.close
set file = nothing
set fso = nothing

%>
Excellence. Our Measure. Our Motto. Our Goal.