Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Mar 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Counter problems.

    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
    a.close
    Set a = fs.CreateTextFile(fp, True)
    a.WriteLine(ct)
    a.Close
    Set a = Nothing
    Set fs = Nothing
    else
    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.

  • #2
    SSJ
    SSJ is offline
    Regular Coder
    Join Date
    Mar 2007
    Posts
    230
    Thanks
    0
    Thanked 4 Times in 4 Posts
    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...

  • #3
    Senior Coder
    Join Date
    Apr 2003
    Location
    England
    Posts
    1,192
    Thanks
    5
    Thanked 13 Times in 13 Posts
    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.
    Last edited by ghell; 03-22-2007 at 06:38 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •