<% 
'This script accepts 2 inputs
' filename
'    which should equal the filename of the file to be written and
' thetext
'    which should contain the text string to write to the file

' Example: setting filename=testfile.txt and thetext=Hello World
'  should write Hello World to testfile.txt in the same folder as this script on the server


'map the file path to the server
mappedfile = Server.MapPath( Request("filename") )

'Create the FileSystemObject
set fs = Server.CreateObject("Scripting.FileSystemObject")

'Now let's open the text file
set outfile = fs.OpenTextFile( mappedfile, 2, True)

' Write the contents to the text file
outfile.WriteLine( Request("thetext") )

' CLose the file
outfile.close()

' Clear the variables
set fs=nothing
set outfile=nothing
%>
Result=1
