Current location: Hot Scripts Forums » Programming Languages » ASP » hit count


hit count

Reply
  #1 (permalink)  
Old 01-17-06, 11:10 AM
vkm vkm is offline
New Member
 
Join Date: Jan 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Red face hit count

I have created a website and hosted it. I want to get the hitcount on my home page. To test the following asp is used:


<html>
<head>
<title>Hit Counter</title>
</head>
<body bgcolor="white" text="black">
<%
'Dimension variables
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
Response.Write(lngVisitorNumber)
%>
</body>
</html>


But I am getting the error message:

Microsoft VBScript runtime error '800a0046'

Permission denied

/Hitcount/h.asp, line 24

How do i set the read/write permission to the file "hit_count.txt" on the server ?
Reply With Quote
  #2 (permalink)  
Old 01-24-06, 03:58 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,075
Thanks: 11
Thanked 88 Times in 83 Posts
Usually with your FTP tool. Do right click on the "hit_count.txt" file and have a look there.
Reply With Quote
  #3 (permalink)  
Old 01-25-06, 02:30 PM
MadDog MadDog is offline
Code Master
 
Join Date: Aug 2003
Posts: 935
Thanks: 0
Thanked 0 Times in 0 Posts
* Topic moved to the correct forum *



The permission denied error is because you do not have Read/Write permissions setup for the folder the file is listed on. You will have to contact your host and see if they will set this.

Right clicking in the FTP wont do you crap.
__________________
Drew Gauderman
ASP - MSSQL Coder / Buisness Owner / Coder for Hire!
MSN-ICQ-AIM-YIM in Profile

http://www.iportalx.net an easy ASP portal system.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Count lines in Text area Markone Everything Java 0 01-01-06 08:41 PM
Help with C Code..need to count unique words jasonsthomas C/C++ 3 12-08-04 06:50 AM
Count Searches? fraggle PHP 7 09-19-04 01:59 PM
Hit Per Click ivan PHP 3 04-13-04 07:43 AM
Post count, why? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 7 10-06-03 03:29 PM


All times are GMT -5. The time now is 03:37 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.