View Full Version : Counter problems.

03-22-2007, 05:52 AM
Hi everyone, i'm new in the coding and programing for asp, but i'm currently helping a friend out with his website. After a bunch of troubles with the new server (godaddy) I was able to set the website just the way he had it before, but now i realize that there is a problem with the counter, I typed the address of the website and I get this message at the bottom:

Microsoft VBScript runtime error '800a0046'

Permission denied

/index.asp, line 94

And I just find out that the 94th line in the index.asp is my counter:

Set a = fs.CreateTextFile(fp, True)

My counter asp file is now like this:

<%@ Language="VBScript" %>
<% Response.Expires= -1
Response.AddHeader "Cache-Control", "no-cache"
Response.AddHeader "Pragma", "no-cache" %>
if Session("ct") = "" then
fp = Server.MapPath("count.txt")
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.OpenTextFile(fp)
ct = Clng(a.ReadLine)
ct = ct + 1
Session("ct") = ct
Set a = fs.CreateTextFile(fp, True)
Set a = Nothing
Set fs = Nothing
ct = Clng(Session("ct"))
end if
<p>You are a visitor number <%=ct%>! </p>

And since I have that error message I don't know what could be wrong, if somebody could help me out and tell me what my problem is I will much appreciate it. Thank you so much in advance.

03-22-2007, 01:28 PM
Here what your code on line no 94 doing is creating a text file in a folder where count.txt file resides.

But, this folder doesn't have the write permission so it is not allowing the script to create a folder and throws an error.
That's it...

03-22-2007, 07:36 PM
Yea the "Internet Guest Account" (IUSR_COMPUTERNAME) needs write permissions or you wont be able to create/write to files. (Same goes for read permissions etc if it doesn't have them)

However, I have no idea how godaddy lets you use files and their permissions, I have my own servers.

By the way that should be Server.CreateObject and you should probably avoid Sessions where possible in favour of cookies.