Having trouble getting text stream object to work on local iis server.
The following code results in no response to the browser and subsequent requests to the website after this code is run also get no response from the website until iis is reset.
The set ObjectTextS line is the culprit.
When commented out the browser gets a response.
I figure there must be something wrong with the way I've got the website configured in iss since the code here is pretty much straight from a book that I have used in the past to work with files (sams).
Can anyone suggest what the problem might be here?
The following code results in no response to the browser and subsequent requests to the website after this code is run also get no response from the website until iis is reset.
The set ObjectTextS line is the culprit.
When commented out the browser gets a response.
I figure there must be something wrong with the way I've got the website configured in iss since the code here is pretty much straight from a book that I have used in the past to work with files (sams).
Can anyone suggest what the problem might be here?
Code:
<% @ language= vbscript %>
<% option explicit
%>
<html>
<head>
<title>
data fill asp page
</title>
</head>
<body>
<%
dim out
const forReading=1
const forWriting=2
const forAppending=8
const tristateUseDefault=-2
const tristateTrue=-1
const TristateFalse=0
dim objFs, objTextS, page, file
dim strLine
page="items.txt"
file="c:\webtexts\"&page
set objFs=server.CreateObject("scripting.fileSystemObject")
if objFs.fileExists(file)=true then
response.write "<p>file exists</p>"
set ObjTextS=objFs.openTextFile(file,forReading,tristateFalse)
strLine= objTextS.readLine
response.write ("<p>here is the line...</p><p> "&strLine&"</p>")
objTextS.close
set objTextS=nothing
else
response.write "<p>file does not exists</p>"
end if
set objFs=nothing
response.write("<h1>hi from datafill</h1>")
%>