text stream object not working on local server
Having trouble getting text stream object to work on local 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 untill iis is reset. What might my problem be?
the set ObjectTextS line is the culprit.
When commented out the browser gets a response.
What might be the problem?
<% @ 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>")
%>
Andy Kohlenberg
Jerusalem, Israel
Peter J. Boettcher posted this at 13:34 — 27th September 2002.
They have: 812 posts
Joined: Feb 2000
Make sure the IUSR_machinename account has access to whatever directories you're going to be using. Also make sure you don't have any anti-virus software on your server that might block scripting access to directories.
Other than that, your code looks fine.
PJ | Are we there yet?
pjboettcher.com
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.