|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hit Counter - Not Using Application Only - Need Help
<i><b>Originally posted by : merLin (driggins@lockbox.com)</b></i><br />For a recent project, I needed to create a hit counter, and it seemed simple enough, just throw an application variable and increment it by sessions. Only problem is that the host auto-reboots the server every 24 hours, so it erases the data every day.<br /><br />So to fix this I embarked on a journey to create a "real" asp hit counter.<br /><br />To do this I used the OpenTextStream method of the FileSystem object to create a text file, and read the file, then after I've read and set the number to my Application variable, I close the file, re-open it with ForWrite instead of ForRead, and do a WriteLine call with the new value that has incremented. This would store it in a text file so it would never get erased. And in theory it works great, but I'm not even getting past the most basic of problems, getting error:<br /><br />Server.CreateObject Failed...<br /><br />but the weird thing is right after that it says the operation completed successfully, but it didn't create a text file..?<br /><br />Does anyone know of an easier way or where someone else has already made some of this code?<br /><br /> Any Help is Appreciated...<br /><br />Thanks,<br />merLin
|
|
#2
|
|||
|
|||
|
<i><b>Originally posted by : steve</b></i><br /><br />http://aspfree.com/asp/startpage.asp?id=45<br /><br />here is a text file demo, just make sure the iusr account has write permissions.<br /><br />------------<br />merLin at 5/11/2000 5:15:12 AM<br /><br />For a recent project, I needed to create a hit counter, and it seemed simple enough, just throw an application variable and increment it by sessions. Only problem is that the host auto-reboots the server every 24 hours, so it erases the data every day.<br /><br />So to fix this I embarked on a journey to create a "real" asp hit counter.<br /><br />To do this I used the OpenTextStream method of the FileSystem object to create a text file, and read the file, then after I've read and set the number to my Application variable, I close the file, re-open it with ForWrite instead of ForRead, and do a WriteLine call with the new value that has incremented. This would store it in a text file so it would never get erased. And in theory it works great, but I'm not even getting past the most basic of problems, getting error:<br /><br />Server.CreateObject Failed...<br /><br />but the weird thing is right after that it says the operation completed successfully, but it didn't create a text file..?<br /><br />Does anyone know of an easier way or where someone else has already made some of this code?<br /><br /> Any Help is Appreciated...<br /><br />Thanks,<br />merLin
|
![]() |
| Viewing: ASP Free Forums > Programming > ASP Development > Hit Counter - Not Using Application Only - Need Help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|