M
McTuble
So I'm new to ASP and set it up on my computer and just want a simple text
based guestbook where it just adds your entry to the end of the textfile and
to display just displays the contents of the textfile. So displaying the
contents is not the problem. Here is the code
<html>
<body>
<% Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
%>
<FORM action="signBook.asp" method="GET">
name:<INPUT TYPE="text" NAME="name">
message:<INPUT TYPE="text" NAME="message">
<INPUT TYPE="submit">
</FORM>
<%
n=request.querystring("name")
m=request.querystring("message")
if n<>"" And m<>"" then
set fs = Server.CreateObject("Scripting.FileSystemObject")
set f = fs.OpenTextFile("guestbook.txt", ForAppending, true)
f.WriteLine("This line is added to the file.")
f.Close()
end if
if n="" And m="" then
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile(Server.MapPath("guestbook.txt"), 1)
Response.Write(f.ReadAll)
f.Close()
end if
%>
</body>
</html>
I get the Permission denied error on this line -> set f =
fs.OpenTextFile("guestbook.txt", ForAppending, true)
I have been all over the internet and tried giving the folders write access
through the control panel -> administrative tools -> internet information
services and I've also tried right clicking the folder and clicking on
properties. Then the security tab. Can anyone help me? It's kinda important
I get this out of the way. I am using Windows XP Professional with Service
Pack 2. Thanks guys.
based guestbook where it just adds your entry to the end of the textfile and
to display just displays the contents of the textfile. So displaying the
contents is not the problem. Here is the code
<html>
<body>
<% Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
%>
<FORM action="signBook.asp" method="GET">
name:<INPUT TYPE="text" NAME="name">
message:<INPUT TYPE="text" NAME="message">
<INPUT TYPE="submit">
</FORM>
<%
n=request.querystring("name")
m=request.querystring("message")
if n<>"" And m<>"" then
set fs = Server.CreateObject("Scripting.FileSystemObject")
set f = fs.OpenTextFile("guestbook.txt", ForAppending, true)
f.WriteLine("This line is added to the file.")
f.Close()
end if
if n="" And m="" then
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.OpenTextFile(Server.MapPath("guestbook.txt"), 1)
Response.Write(f.ReadAll)
f.Close()
end if
%>
</body>
</html>
I get the Permission denied error on this line -> set f =
fs.OpenTextFile("guestbook.txt", ForAppending, true)
I have been all over the internet and tried giving the folders write access
through the control panel -> administrative tools -> internet information
services and I've also tried right clicking the folder and clicking on
properties. Then the security tab. Can anyone help me? It's kinda important
I get this out of the way. I am using Windows XP Professional with Service
Pack 2. Thanks guys.