Ciao Sarionline,
devi prima leggere il contenuto del file (quindi aprire il file in lettura) poi riapri il file in scrittura, ci scrivi quello che devi scrivere + quello che avevi già scritto
codice:
' Create an instance of the FileSystemObject
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
' Open the TextFile (FileName, ForAppending, AllowCreation)
Set objFile = objFSO.OpenTextFile(strFile, 1, True) 'apro in lettura
if not objFile.AtEndOfStream then 'se il file non è vuoto
ContenutoFile=objFile.ReadAll 'leggo tutto e metto nella variabile ContenutoFile
end if
objFile.Close
Set objFile = objFSO.OpenTextFile(strFile, 2, True) 'apro in scrittura
If InStr(1, Request.Form("comment"), "http://", 1) = 0 Then
' Log the results
' I simply bold the name and do a
.
' You can make it look however you'd like.
' Once again I remind readers that we by no means claim to
' be UI experts. Although one person did ask us if we had a
' graphic designer! I laughed so hard that I almost hurt myself!
objFile.Write "<div style='width:100%; padding:2px; background-color:#CECECE;'>" & Date() & " - " & Time() & "</div>"
objFile.Write "<font color=#D20707>"
objFile.Write Server.HTMLEncode(Request.Form("name"))
objFile.Write "</font>
"
objFile.Write Server.HTMLEncode(Request.Form("comment"))
objFile.Write "
"
objFile.WriteLine ""
objFile.Write ContenutoFile 'agiungo alla fine quello che era già presente nel file
End If
' Close the file and dispose of our objects
objFile.Close
Set objFile = Nothing
Set objFSO = Nothing