NightWatcher
Programmer
Hi there,
I used the following code in Xitami web server and it worked fine, but now in IIS 5.0 it just doesn't.
The code just writes a text file with a number in it to be retrieved later by another page.
Code to write file:
======================================================
<%
Option Explicit
Response.Expires = -1
Dim FileObject, CounterFile, InPut , OutPut, NewCount, OldCount
Set FileObject = Server.CreateObject("Scripting.FileSystemObject"
CounterFile = Server.MapPath ("counterHOME.txt"
Set InPut = FileObject.OpenTextFile (CounterFile, 1, False)
OldCount = Trim(InPut.ReadLine)
NewCount = OldCount + 1
Set OutPut = FileObject.CreateTextFile (CounterFile, True)
OutPut.WriteLine(NewCount)
InPut.Close
OutPut.Close
Set FileObject = Nothing
Set InPut = Nothing
Set OutPut = Nothing
%>
Code to read file:
======================================================
<%
Option Explicit
Response.Expires = -1
Dim FileObject, CounterFile, InPut, OldCount
Set FileObject = Server.CreateObject("Scripting.FileSystemObject"
CounterFile = Server.MapPath ("counterHOME.txt"
Set InPut = FileObject.OpenTextFile (CounterFile, 1, False)
OldCount = Trim(InPut.ReadLine)
InPut.Close
Set FileObject = Nothing
Set InPut = Nothing
%>
Read/Write permissions are set to the file.
Can anyone tell me what's wrong with it?
Is it the object that doesn't exist in IIS?
How do I verify if it exists or not?
Or, do you know of an easy and simple alternative?
Thank you.
NightWatcher
I used the following code in Xitami web server and it worked fine, but now in IIS 5.0 it just doesn't.
The code just writes a text file with a number in it to be retrieved later by another page.
Code to write file:
======================================================
<%
Option Explicit
Response.Expires = -1
Dim FileObject, CounterFile, InPut , OutPut, NewCount, OldCount
Set FileObject = Server.CreateObject("Scripting.FileSystemObject"
CounterFile = Server.MapPath ("counterHOME.txt"
Set InPut = FileObject.OpenTextFile (CounterFile, 1, False)
OldCount = Trim(InPut.ReadLine)
NewCount = OldCount + 1
Set OutPut = FileObject.CreateTextFile (CounterFile, True)
OutPut.WriteLine(NewCount)
InPut.Close
OutPut.Close
Set FileObject = Nothing
Set InPut = Nothing
Set OutPut = Nothing
%>
Code to read file:
======================================================
<%
Option Explicit
Response.Expires = -1
Dim FileObject, CounterFile, InPut, OldCount
Set FileObject = Server.CreateObject("Scripting.FileSystemObject"
CounterFile = Server.MapPath ("counterHOME.txt"
Set InPut = FileObject.OpenTextFile (CounterFile, 1, False)
OldCount = Trim(InPut.ReadLine)
InPut.Close
Set FileObject = Nothing
Set InPut = Nothing
%>
Read/Write permissions are set to the file.
Can anyone tell me what's wrong with it?
Is it the object that doesn't exist in IIS?
How do I verify if it exists or not?
Or, do you know of an easy and simple alternative?
Thank you.
NightWatcher