Is there any reason why this shouldn't work?
The problem: the code fragment fs.FileExists("news.asp")=true *ALWAYS* evaluates to false, so it always goes to the ELSE statement. And yes, "news.asp" exists in the same directory as the script itself, so that's not the problem. Anything else obvious that I've got wrong? Thanks.
Code:
<%
set newsNAME=request.querystring("fileindex")
set fs=Server.CreateObject("Scripting.FileSystemObject")
If newsNAME <> "" And fs.FileExists("news.asp")=true Then
set f=fs.OpenTextFile(Server.MapPath("newsdocs/" & newsNAME & ".txt"),1)
Else
set f=fs.OpenTextFile(Server.MapPath("newsnotfound.txt"),1)
End If
%>
The problem: the code fragment fs.FileExists("news.asp")=true *ALWAYS* evaluates to false, so it always goes to the ELSE statement. And yes, "news.asp" exists in the same directory as the script itself, so that's not the problem. Anything else obvious that I've got wrong? Thanks.