header
Google
  Last Updated : Apr 13, 2008 Visited since Apr 18, 2007: 20,069 times  
 

Example to write to text file :

<%
session("txt")="Write this text in the file"
Set fs = CreateObject("Scripting.FileSystemObject")
Set wfile = fs.CreateTextFile(Server.MapPath("/test.txt"), True)

wfile.Write (session("txt"))

wfile.close
Set wfile=nothing
Set fs=nothing

response.write("Text created")
%>

Example to read from text file :

<%
Set fs = CreateObject("Scripting.FileSystemObject")
Set wfile = fs.OpenTextFile(Server.MapPath("/test.txt"))

session("Test") = wfile.ReadAll

wfile.close
Set wfile=nothing
Set fs=nothing

response.write(session("Test"))
%>