473,396 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

another permission denied error

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.
Sep 2 '05 #1
3 8458
"McTuble" <mo*********@hotmail.com> wrote in message
news:uj**************@TK2MSFTNGP10.phx.gbl...
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.


Your files are in different locations as
"guestbook.txt"
and
Server.MapPath("guestbook.txt")
are not the same.

Try this. Watch for word-wrap.

<%@ Language="VBScript" %>
<% Option Explicit
'*
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
'*
Dim n
n = request.querystring("name")
Dim m
m = request.querystring("message")
'*
Dim dat
Dim fso
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Dim otf
Dim txt
txt = Server.MapPath("guestbook.txt")
'*
if n<>"" And m<>"" then
Set otf = fso.OpenTextFile(txt, ForAppending, true)
otf.WriteLine("This line is added to the file.")
else
Set otf = fso.OpenTextFile(txt, ForReading)
dat = Replace(otf.ReadAll,vbCrLf,"<br>")
Response.Write(dat)
end if
'*
Set otf = Nothing
Set fso = Nothing
%>
<html>
<body>
<FORM action="guestbook.asp" method="GET">
name: <INPUT TYPE="text" NAME="name">
message: <INPUT TYPE="text" NAME="message">
<INPUT TYPE="submit">
</FORM>
</body>
</html>
Sep 2 '05 #2
Hi McTuble,

After you did the "right clicking the folder and clicking on properties.
Then the security tab," what did you do? Did you modify the permissions at
all? IN an typical setup, IUSR_name_of_your_computer will need read/write
permissions to the file you're trying to modify.

Ray at work

"McTuble" <mo*********@hotmail.com> wrote in message
news:uj**************@TK2MSFTNGP10.phx.gbl...
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.

Sep 2 '05 #3
Thanks McKirahan it was exactly that. I just changed set f =
fs.OpenTextFile("guestbook.txt", ForAppending, true) to set f =
fs.OpenTextFile(Server.MapPath("guestbook.txt"), ForAppending, true). Thanks
as well to you Ray for trying to help me. I had indeed changed the file
permissions. I was just explaining that I used both of those methods to do
so. Also thanks for the quick response.
Sep 2 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: msnews.microsoft.com | last post by:
I'm running a intranet site on a NT 4.0 IIS 4 server. I have a page that uses CDONTS. I recently change this intranet application to run as an isolated process (Selecting the checkbox "Run in...
6
by: Jon Montana | last post by:
CDONTS was working well until I installed Exchange 2000. I thought it might be a relay problem, but I allowed the server IP address to relay. Thanks for anything you can offer. here's the...
4
by: Adam Smith | last post by:
I have a dedicated server running 'FreeBSD 4.9 STABLE' at a hosting site. They have done some default installations, presumably from the CVS ports package ??. Herein lies the problem, "I do not...
2
by: PM Creyghton | last post by:
I got this error without using frames: First of all, I'm developing an ASP application, and once in a while my activeX components crash or hang, I got page-not-found errors, errors generated by...
1
by: Mark E. Hamilton | last post by:
Sorry, I probably should have re-stated the problem: We're using Python 2.3.5 on AIX 5.2, and get the follow error messages from some of our code. I haven't yet tracked down exactly where it's...
10
by: Florian G. Pflug | last post by:
Hi I installed a postgres-application (which was developed on debian woody) on red hat 9 today, using the postgres 7.3 rpms from redhad. One of my the triggers uses the pg_settings table (more...
3
by: fniles | last post by:
In our ASP page, we call XMLHttp to download XML files. When calling our page using localhost (localhost/myWebSite/myPage.htm), it works, but when calling using the IP address of the web server...
0
by: debug03 | last post by:
I am executing a DTS package on a Windows 2000 sp4 server running SQL Server 2000 and IBM DB2 V7 client. The DTS package source data(SQL Server) is selected from SQL server table and inserts data to...
9
by: Tony Proctor | last post by:
I need to create a process Singleton object for an ASP application, but I'm having some odd issues In my GLOBAL.ASA, I have an <OBJECTelement specifying the relevant ProgID with RUNAT=Server and...
0
by: Tim Golden | last post by:
aditya shukla wrote: Why on earth are you *specifying* c:\python25 as the directory for this file? It's automatically created in your user-specific temp directory which has specific permissions...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.