<%@ Import Namespace="System.IO" %>
<%
Response.write("Reading the content from the text file ASPNET.TXT
")
' create a stream reader object
Dim streamreaderobj As StreamReader
' Declare a variable for holding the content read from the file
Dim filecont As String
' Open the text file and assign it to streamreader object
streamreaderobj = File.OpenText( "c:\aspnet.txt" )
' Read the content of the file line by line employing streamreaderobj
' Note that when filecont gets a value emptystring ("") it indicates end of file
Do
filecont = streamreaderobj.ReadLine()
Response.Write( filecont & "
" )
Loop Until filecont = ""
' Close the streamreader object after the reading operation
streamreaderobj.Close
Response.write("
Done with reading the content from the file aspnet.txt")
%>