Microsoft VBScript runtime error '800a0046'

  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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


               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.
leoumarAuthor Commented:
(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.

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.

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

leoumarAuthor Commented:
i have fat32  partitions.
leoumarAuthor Commented:
ok let me know one thing ,
is it dangrous to give my site 's folder to write permission
if your database has a password make sure you include that in your connection string


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?

leoumarAuthor Commented:
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 & """>")

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!
leoumarAuthor Commented:
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.
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. ;)


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.