|
Explaination
The first line of code uses the IIS provided Request object to find
the value present in the txtbox that is filed in the form.
textstr=Request.Form("txtbox")<
/FONT>
The value is stored in the textstr
variable.
Next the Fileobject is opened it's
reference is stored in the Fileobject variable.
Set FileObject =
Server.CreateObject("Scripting.FileSystemObject")
TestFile = Server.MapPath ("/asp") & "\textwork.txt"
Then we specify the file name and
it's path and store it in a variable called Testfile. Here we have a
file called textwork.txt to which all the text of the chat is
appended.
Next step is to open this file in
append mode by specifying the number 8 to the OpenTextFile method.
Set OutStream=
FileObject.OpenTextFile (TestFile, 8, TRUE)
ipaddr=Request.ServerVariables("REMOTE_ADDR") & " : "
The other thing that is being done
in this section is storing the ip address of the client to a
variable and appending the string " :" to it.
OutStream.Write ipaddr
Writes the IP address of the client
to the file.
OutStream.WriteLine textstr & "<BR>"
Writes the text written by the
client and appends the BR tag. This tag is added so that when we
display the chat session to the clients with each text row on a new
line.
Once having done that the stream is
closed that is opened to the file.
Set OutStream = Nothing< /FONT >
Next: Creating Excel WorkSheets with ASP
Index: Active Server Pages\IIS |