Forum Moderators: open
strCompany = Request.Form("company")
strPhone = Request.Form("phone")
strPassword = Request.Form("pwd")
strEmail = CStr(Request.Form("email"))
Set pwdObj=Server.CreateObject("Scripting.FileSystemObject")
Set gtFile = pwdObj.OpenTextFile(Server.MapPath("logon.txt"))
Dim strLine
'checks if user exists
While Not gtFile.AtEndOfStream
strLine = gtFile.ReadLine
If InStr(strLine, strEmail) Then
gtfile.Close
Response.Redirect "userexists.asp"
End If
WEND
strEmail = Request.Form("email")
Record1 = (strCompany&" "&strEmail&" "&strPassword&" "&strPhone)
Set myFSO = CreateObject("Scripting.FileSystemObject")
Set WriteRecord = myFSO.OpenTextFile("register.txt",8, True)
WriteRecord.WriteLine(Record1)
WriteRecord.Close
SET WriteRecord = NOTHING
Object named myFSO
SET myFSO = NOTHING
%>
It doesn't write anything to 'register.txt'
What am I missing?
thanks
magyar
I would try using Server.MapPath to write the file into a directory relative to the script that is running. I ran it on my machine as you provided and received the same error.. then used Server.MapPath , and it wrote out successfully to the script directory..
Set WriteRecord = myFSO.OpenTextFile(Server.MapPath("randomfilename.txt"),8, True)
HTH,
Mark