count no of visitor
how to count total number of visitors in .net??
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
vijayPosted Aug 1, 2012, 7:07 AM
Refer the below link to count the total vistors in .net
http://www.dotnetcode.in/2011/06/how-to-find-number-of-online.html
Satyapriya NayakPosted Jul 30, 2012, 3:47 AM
Count the total number of visitors enter to a website
Default.aspx code
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
Default.aspx.vb code
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim result As Integer
result = Convert.ToInt32((Application("usercount")))
Label1.Text = Convert.ToString(result)
If (result < 10) Then
Label1.Text = "000" + Label1.Text
ElseIf (result < 100) Then
Label1.Text = "00" + Label1.Text
ElseIf (result < 1000) Then
Label1.Text = "0" + Label1.Text
End If
End Sub
End Class
Global.asax code
<%@ Application Language="VB" %>
Dim count As Integer = 0
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application startup
Application("usercount") = count
End Sub
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs on application shutdown
End Sub
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when an unhandled error occurs
End Sub
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a new session is started
count = Convert.ToInt32(Application("usercount"))
Application("usercount") = count + 1
End Sub
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Code that runs when a session ends.
' Note: The Session_End event is raised only when the sessionstate mode
' is set to InProc in the Web.config file. If session mode is set to StateServer
' or SQLServer, the event is not raised.
End Sub
Thanks
If this post helps you mark it as answer
Jignesh TrivediPosted Jul 30, 2012, 3:36 AM
Please refer,
http://www.aspnettutorials.com/tutorials/database/hit-cntr-asp4-cs.aspx
it is good examle of hit count.
same thing you can achive writing code in Application_beginRequest event of global.aspx file.
hope this will help you.
rohit pzatelPosted Jul 30, 2012, 3:14 AM
Hardik PatelPosted Jul 28, 2012, 4:17 AM
Shubham SaxenaPosted Jul 28, 2012, 2:56 AM