Hitcounter

Topics: Developer Forum, User Forum
May 13, 2008 at 9:12 PM
Hi

how can I display a hit counter on the frontpage ?

May 23, 2008 at 7:35 AM
never mind - found the hitcounter extension
Jun 9, 2008 at 2:05 PM
Edited Jun 9, 2008 at 2:08 PM
Hello,

What disturbed me with HitCounter is the fact that it counts EVERY hit of the page.. What I want is to count the actual number of Visitors.. Therefore I have to keep all IPs in a List, and then check if the visitor already has visited the page (so he or she is not counted twice..)

I have implemented a new EasyControl "HitCounter2" which solves that issue (and can display some more infos, like user client, dns name..)

I'll publish it here as soon I ve finished it (estimated at the end of this week...)

What I also have in mind is a form for administrators where one can view all IPs, dns names and LastVisit dates of all visitors... (I still don't know if it is possible to view  a different GUI for an easy control if administrator is logged in, but i guess i'll have to check if current user IsInRole "admin" .. or something like that..
Jun 9, 2008 at 11:30 PM
Edited Jun 9, 2008 at 11:50 PM
Beta version of HitCounter2 is now finished :-)
Have a look at my test page - at the bottom of "Home" you ' ll find the counter:

http://raimund.net.tf

This does not have administrator GUI, but behaviour can be changed in config file (For further instructions have a look at the readme file in the zip-archive)

Download here:   MWPSK_HitCounter2.zip
Jun 9, 2008 at 11:31 PM
Edited Jun 9, 2008 at 11:51 PM
Beta version of HitCounter2 is now finished :-)
Have a look at my test page - at the bottom of "Home" you ' ll find the counter:

http://raimund.net.tf

This does not have administrator GUI, but behaviour can be changed in config file (For further instructions have a look at the readme file in the zip-archive)

Download here:   MWPSK_HitCounter2.zip
Jul 7, 2008 at 8:31 AM
I have been using the hit counter 2 for a few weeks now & it's just had a meltdown.

Went to log onto web site this morning & go this error

<title>Unexpected end of file has occurred. The following elements are not closed: key, item, VisitorData, HitDataExt. Line 247, position 37.</title> <style> body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } </style>

Server Error in '/' Application.

Unexpected end of file has occurred. The following elements are not closed: key, item, VisitorData, HitDataExt. Line 247, position 37.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Xml.XmlException: Unexpected end of file has occurred. The following elements are not closed: key, item, VisitorData, HitDataExt. Line 247, position 37.

Source Error:

Line 239:            reader.ReadStartElement("item");
Line 240:            reader.ReadStartElement("key");
Line 241:            TKey key = (TKey)keySerializer.Deserialize(reader);
Line 242:            reader.ReadEndElement();
Line 243:            reader.ReadStartElement("value");

Source File: *******************************\EasyControls\HitCounter2.ascx.cs    Line: 241




It seems that hit counter 2 didn't write all of it's data to the config file as half of it was missing.




Jul 7, 2008 at 10:24 AM
Hello!

Seems that your hit2.config file has been corrupted
I don't know why, it has never happened in my case .. Maybe server crashed once or something like request was interrupted by user (?)
You could send me your hit2.config from you App_Data directory, so that I may be able to repair it (some data lost of course)
I suppose I should include a mecanism to save a backup of the .config file so that can't happen in the future (or at least the data can be recovered from previous state)

Regards,
Ray
Jul 8, 2008 at 3:50 AM
Thanks for your reply, I have fixed the .config file  this is the last lines that were in it.

    <item>                           
      <key>                          
        <string>************</string> 

It looks like about 3/4 of the file was not written.

It would be good if you could change the program so one could recover from an incident like this.

Thanks Ray.

Regards
Pete


Aug 24, 2008 at 12:57 AM
Edited Aug 24, 2008 at 6:36 AM
Hello again,

I updated my HitCounter2 to version 1.1

Now a backup file is created (HITS2.config.bak) before updating the XML file. So to say, in HITS2.config.bak can be found the previous state of the counter.

Download here: HitCounter2_v1.1

or here: http://raimundo.dotnethost.at/mwpskdownloads.aspx

Regards,
Ray



Aug 27, 2008 at 12:03 PM
Thanks Ray,

Just loaded it on the web site & it's working good.

Regards
Pete
Sep 6, 2008 at 8:40 AM
Edited Sep 6, 2008 at 1:15 PM
Is there any way of starting the new hitcounter at anything other than zero, this of course lets you retain previous hits before changing over to the MWPSK package. Thanks :-)

Ron

UPDATE: Thanks to Ray, I have reset the counter back to what it was before merging an oldsite into a new MWPSK skin, the answer lies in the App_Data folder in the Hits2.config file, with this sparkling gem of a line: <HitCount>1306</HitCount>