Microsoft VBScript runtime error '800a0046'

Posted on 2004-11-09
Last Modified: 2009-12-16
  I have a problem with my asp page the error is

Microsoft VBScript runtime error '800a0046'
Permission denied
/hit/default.asp, line 34

and at line 34 code is

Set tsObject = fsoObject.CreateTextFile(Server.MapPath("hit_count.txt"))

Actually the story is.
I have make a hit counter that gets the value from a text files , show it on the page and after it agin creates a new file and overwrite the new value, It works on my pc well ;(I am using Windows XP).
I searched and found that it is due to less permission given by the web hosting company.and I should call them to give write permission my folder that is hosted on a server.I try to verify that is it the correct reason, so I give only READ ( not write)  permission on my PC, but it still works.
PLz tell me whats the matter, and If in actual the above is the real reason than  I will  call me site hosting company to give the write permission, But I afraid will it be harmfull, as everyone will have the write permission.
plz suggess the best solution.
Question by:leoumar
    LVL 6

    Expert Comment


                   Yes the problem is that you don't have the access rights to write into that folder. you have to give
    (Folder ---> Properties -----> Security --> 'Everyone' ) everyone read, wirte access but not full control access (which is dangerous).

    No everyone has fullcontrol permission is dangerous but read and write permission is not a problem.

    Hope this help you.

    Author Comment

    (Folder ---> Properties -----> Security --> 'Everyone' ) I cannt find it
    (Folder ---> Properties -----> web sharing  --  
    is there, I find there some access and application permissions. I set only the read permission but it still write in the file.
    LVL 9

    Expert Comment


    We first need to determine if you're on NTFS.  Right click on the drive letter your website is on and go to Properties.  It should tell you down below the chart whether it's NTFS or FAT32.  If it's NTFS, please proceed with my following isntructions.  If FAT32, you don't have to even worry about permission.

    If NTFS, follow the isntructions on this page

    Now you should be able to clear Everyone's permisson and make it READ ONLY.


    Author Comment

    i have fat32  partitions.

    Author Comment

    ok let me know one thing ,
    is it dangrous to give my site 's folder to write permission
    LVL 23

    Expert Comment

    if your database has a password make sure you include that in your connection string

    LVL 9

    Expert Comment


    The issue here is not file permission at all.   It cannot be since your hard drive is FAT32.  FAT32 does not support it.

    I agree with apresto regarding the password.  Could you paste your code here so we can determine what's wrong?


    Author Comment

    I havent use any database, Just a txt file.
    here is the code.

    Dim fsoObject                   
    'File System Object

    Dim tsObject                   
    'Text Stream Object

    Dim filObject                  
    'File Object

    Dim lngVisitorNumber             
    'Holds the visitor number

    Dim intWriteDigitLoopCount       
    'Loop counter to display the graphical hit count
    'Create a File System Object variable
    Set fsoObject = Server.CreateObject("Scripting.FileSystemObject")

    'Initialise a File Object with the path and name of text file to open

    Set filObject = fsoObject.GetFile(Server.MapPath("hit_count.txt"))
    'Open the visitor counter text file
    Set tsObject = filObject.OpenAsTextStream
    'Read in the visitor number from the visitor counter file
    lngVisitorNumber = CLng(tsObject.ReadAll)
    'Increment the visitor counter number by 1
    lngVisitorNumber = lngVisitorNumber + 1
    'Create a new visitor counter text file over writing the previous one

    Set tsObject = fsoObject.CreateTextFile(Server.MapPath("hit_count.txt"))
    'Write the new visitor number to the text file
    tsObject.Write CStr(lngVisitorNumber)
    'Reset server objects
    Set fsoObject = Nothing
    Set tsObject = Nothing
    Set filObject = Nothing

    'Display the hit count as text

    'Loop to display graphical digits
    For intWriteDigitLoopCount = 1 to Len(lngVisitorNumber)
          'Display the graphical hit count
          Response.Write("<img src=""counter_images/")
          Response.Write(Mid(lngVisitorNumber, intWriteDigitLoopCount, 1) & ".jpg""")
          Response.Write("alt=""" & lngVisitorNumber & """>")

    LVL 9

    Expert Comment

    OK.  Here is what's happening:

    On your PC, you are running FAT32 which does not have the file security feature; your web hosting does.  The user account that runs the ASP page does not have access to WRITE files to that folder.  It's their security rules.  You'll have to ask them to give permission to the user your website is running as to write to your web folder.  I'm sure they'll do it for you.  After all, it's you who's taking the risk, they won't care about your files more than you. :)

    You won't be able to duplicate the issue on your PC since you are running FAT32.  You COULD try and convert your hard drive to NTFS to duplicate the issue, but I wouldn't recommend it.  It's a good idea to run NTFS in general, but for your reason, it's not worth the risk.  Some major things could break, and for what..?

    I'd just ask them to do it.

    Let us know!

    Author Comment

    plz let me know thing one and the last thing ,
    If I call the hosting compnay to do so, they shall do it confirmly, but

    Did u think it is harmful to give access of write to some

    folder, and also i want to say that this folder is inside main folder, thats y we must have to give the write access to main folder too.
    I have seen an alert msg from microsft windows that warns to give the access.
    LVL 9

    Accepted Solution

    It all depends on what you have on your website.  Hackers will not hack just for fun.  They usually hack sites to get stuff: credit card, calling card pins, etc.  If you're running a standard page that just displays a few information about something, with no database or files holding critical data, what if they break in it?  It'll be their disappointment.  They'll change your page and put something that says "All your base are belong to us" and call it a day, you can easily delete that and put back your files from your backup (which you'd better always have); and you're back!

    I don't believe it's that harmful to do it.

    I wouldn't recommend giving write access to ALL folders including the root.  I'd do it in a subfolder that holds nothing but your counter file.  That way there is not much to break if it was compromised. ;)


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
    This demonstration started out as a follow up to some recently posted questions on the subject of logging in: and…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now