I am trying to run this ASP script
<%
Set MyFileObj = Server.CreateObject("Scripting.FileSystemObject")
Set MyTextFile = MyFileObj.OpenTextFile("inetpub\wwwroot\intranet\quotes.txt")
IF NOT MyTextFile.AtEndOfStream THEN
header=CInt(MyTextFile.Readline)
END IF
RANDOMIZE
LowestNumber = 1
HighestNumber = header
RandomValue = INT((HighestNumber-LowestNumber+1)*Rnd+LowestNumber)
Count=0
WHILE NOT MyTextFile.AtEndOfStream AND NOT Count = RandomValue
quote = MyTextFile.Readline
Count=Count+1
WEND
MyTextFile.CLose
%>
but i keep getting this error:
Microsoft VBScript runtime error '800a004c' Path not found
It works fine on my local server, I have tried variations of the path name once I FTP the script to our main server and no matter what I keep getting this error. I dont know why as all my other scripts work fine.
Please can someone tell me where I am going wrong.you need to provide the full path to your file (including the drive letter)Thanks for the help, just as a matter of interest, why do I have to provide the driveletter when previously it has worked without it for other scripts?What is your connection string?("inetpub\wwwroot\intranet\quotes.txt")
If i put the driveletter it works fine. For other scripts I dont need to do this
<%
Set MyFileObj = Server.CreateObject("Scripting.FileSystemObject")
Set MyTextFile = MyFileObj.OpenTextFile("inetpub\wwwroot\intranet\quotes.txt")
IF NOT MyTextFile.AtEndOfStream THEN
header=CInt(MyTextFile.Readline)
END IF
RANDOMIZE
LowestNumber = 1
HighestNumber = header
RandomValue = INT((HighestNumber-LowestNumber+1)*Rnd+LowestNumber)
Count=0
WHILE NOT MyTextFile.AtEndOfStream AND NOT Count = RandomValue
quote = MyTextFile.Readline
Count=Count+1
WEND
MyTextFile.CLose
%>
but i keep getting this error:
Microsoft VBScript runtime error '800a004c' Path not found
It works fine on my local server, I have tried variations of the path name once I FTP the script to our main server and no matter what I keep getting this error. I dont know why as all my other scripts work fine.
Please can someone tell me where I am going wrong.you need to provide the full path to your file (including the drive letter)Thanks for the help, just as a matter of interest, why do I have to provide the driveletter when previously it has worked without it for other scripts?What is your connection string?("inetpub\wwwroot\intranet\quotes.txt")
If i put the driveletter it works fine. For other scripts I dont need to do this