| | |
Webcounter
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
Why don't you track it with statistics?
Anyway, if you really want it, you can use global.asax file for that.
In Application_Start and Application_End event of global.asax set something like this:
Then, in Session events use this:
Note: Set sessionstate mode to InProc in the web.config file.
To show it just put this in page:
Hope this helps, I haven't tested it.
Anyway, if you really want it, you can use global.asax file for that.
In Application_Start and Application_End event of global.asax set something like this:
ASP.NET Syntax (Toggle Plain Text)
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) Application("Online") = 0 End Sub Sub Application_End(ByVal sender As Object, ByVal e As EventArgs) Application("Online") = 0 End Sub
Then, in Session events use this:
ASP.NET Syntax (Toggle Plain Text)
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) Application("Online") += 1 End Sub Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) Application("Online") -= 1 End Sub
Note: Set sessionstate mode to InProc in the web.config file.
To show it just put this in page:
ASP.NET Syntax (Toggle Plain Text)
Online users: <%=Application("Online")%>
Hope this helps, I haven't tested it.
Last edited by ManicCW; Feb 12th, 2008 at 8:59 am. Reason: Added code
I have just now realized that you need web count, not number of online users. 
Well just add +1 in Session_Start event and store sum in text file.

Well just add +1 in Session_Start event and store sum in text file.
•
•
Join Date: Jan 2008
Posts: 2,052
Reputation:
Solved Threads: 118
if you want to see number of visits to individual pages,on page load event of each page, you can run insert statement against a database, include url of the page and ip of the user as columns in case you can group the results by these columns later
Due to lack of freedom of speech, i no longer post on this website.
•
•
Join Date: Feb 2008
Posts: 30
Reputation:
Solved Threads: 4
hi ebabes,
I think you needed website counter which simply tells number of times website has been visited rather than individual page visit counter. So, you have 2 alternatives to store Visit Count either in to Text File or in to database. I seen one article based on text file, just check the following link.
http://imar.spaanjaars.com/QuickDocID.aspx?QUICKDOC=227
http://www.daniweb.com/forums/thread6566.html
Hope this will help you. If problem persist then feel free to share with me.
Thanks & Regards
Dilip Kumar Vishwakarma
Programmer
.Net Consulting
I think you needed website counter which simply tells number of times website has been visited rather than individual page visit counter. So, you have 2 alternatives to store Visit Count either in to Text File or in to database. I seen one article based on text file, just check the following link.
http://imar.spaanjaars.com/QuickDocID.aspx?QUICKDOC=227
http://www.daniweb.com/forums/thread6566.html
Hope this will help you. If problem persist then feel free to share with me.
Thanks & Regards
Dilip Kumar Vishwakarma
Programmer
.Net Consulting
•
•
Join Date: Sep 2007
Posts: 1,080
Reputation:
Solved Threads: 68
Yes, you can store them within a database or within text, or even within XML.
For research on my websites to see which ones are popular, in which directories, etc. I store all my information in XML files, and upload them once every 15 minutes to the database server. It prevents an unnecessary hit to the database of thousands of times (which can definitely slow your site). I would recommend just storing page hits in an xml file, then upload the information from the xml file to your database server. Then your entire visitor count can be all page hits combined (a SUM command would work). This way it also lets you know which pages are receiving the majority of the traffic.
Its not much work to do, and I believe it to be highly recommended
For research on my websites to see which ones are popular, in which directories, etc. I store all my information in XML files, and upload them once every 15 minutes to the database server. It prevents an unnecessary hit to the database of thousands of times (which can definitely slow your site). I would recommend just storing page hits in an xml file, then upload the information from the xml file to your database server. Then your entire visitor count can be all page hits combined (a SUM command would work). This way it also lets you know which pages are receiving the majority of the traffic.
Its not much work to do, and I believe it to be highly recommended
•
•
Join Date: Jan 2008
Posts: 2,052
Reputation:
Solved Threads: 118
•
•
•
•
Yes, you can store them within a database or within text, or even within XML.
For research on my websites to see which ones are popular, in which directories, etc. I store all my information in XML files, and upload them once every 15 minutes to the database server. It prevents an unnecessary hit to the database of thousands of times (which can definitely slow your site). I would recommend just storing page hits in an xml file, then upload the information from the xml file to your database server. Then your entire visitor count can be all page hits combined (a SUM command would work). This way it also lets you know which pages are receiving the majority of the traffic.
Its not much work to do, and I believe it to be highly recommended
Last edited by serkan sendur; Feb 20th, 2008 at 10:02 am.
Due to lack of freedom of speech, i no longer post on this website.
•
•
Join Date: Sep 2007
Posts: 1,080
Reputation:
Solved Threads: 68
Not that I know of serk. Hey, can you tell me how to call an onSelectedIndexChanged event from Page_Load? Trying to help someone but I can't seem to get it right.
The reason I say I would do XML is because most of my sites are heavy on database interaction. This way the server does more processing than the SQL server, which is shared among many. Most of the time the SQL server is backed up while the web server is free and clear. That's why I use XML ^^
The reason I say I would do XML is because most of my sites are heavy on database interaction. This way the server does more processing than the SQL server, which is shared among many. Most of the time the SQL server is backed up while the web server is free and clear. That's why I use XML ^^
![]() |
Similar Threads
- Internet Explorer & Windows Explorer (desktop shortcuts) Won't Load! (Viruses, Spyware and other Nasties)
- Unknown Virus (Viruses, Spyware and other Nasties)
- Hijack this log please (Viruses, Spyware and other Nasties)
- Hijacked by http://fastsearch.cc/cxlow/ (Viruses, Spyware and other Nasties)
- HJT Log for http://fastsearch.cc/ (Viruses, Spyware and other Nasties)
- fastsearch will NOT go away!! please help (Viruses, Spyware and other Nasties)
- IE6 has been constantly hijacked by .... (Viruses, Spyware and other Nasties)
- Microsoft IE Offline Pop-ups (Web Browsers)
Other Threads in the ASP.NET Forum
- Previous Thread: How do you search all current sessions on the sever, or within the website?
- Next Thread: How to calculate date with integer
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 activexcontrol ajax alltypeofvideos appliances application asp asp.net bc30451 beginner bottomasp.net box browser button c# cac checkbox commonfunctions control dataaccesslayer database datagridview datagridviewcheckbox datalist deployment development dgv dialog dropdownlist dynamic dynamically edit embeddingactivexcontrol expose feedback fileuploader fill findcontrol flash form formatdecimal formview google gridview gudi iis image javascript listbox login microsoft mobile mouse mssql news novell numerical opera panelmasterpagebuttoncontrols parent radio redirect registration relationaldatabases reportemail save schoolproject search security select sessionvariables silverlight smartcard smoobjects software sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net video videos view vista visualstudio web webapplications webdevelopemnt webdevelopment webprogramming webservice xsl youareanotmemberofthedebuggerusers






