Hello guys,
welcome to my blog!.
Yesterday one of my friend asked me a question regarding how to track the vistors of Asp.net website,so
i thought of putting in my blog so it may be helpfull even to other people.
To achieve this i am going to one of the techniques of the statemanagement called "APPLICATION".
Now question is where to write the code ,please follow the below steps in sequence.
1)Open your Global.asax file
2)Find Application_startevent
3)Now create a Application object named counter (copy paste the below code in your application_start event)
Application.Lock()
Application["counter"] = Application["counter"] + 1
Application.UnLock()
4)Now in the Application object we have track of the count,now how to use in our website home page.
go to your home page ,copy paste the below code in the page_load event of your page
Response.write(Application["counter"].ToString());
This should work,if any problems please put on your comments
welcome to my blog!.
Yesterday one of my friend asked me a question regarding how to track the vistors of Asp.net website,so
i thought of putting in my blog so it may be helpfull even to other people.
To achieve this i am going to one of the techniques of the statemanagement called "APPLICATION".
Now question is where to write the code ,please follow the below steps in sequence.
1)Open your Global.asax file
2)Find Application_startevent
3)Now create a Application object named counter (copy paste the below code in your application_start event)
Application.Lock()
Application["counter"] = Application["counter"] + 1
Application.UnLock()
4)Now in the Application object we have track of the count,now how to use in our website home page.
go to your home page ,copy paste the below code in the page_load event of your page
Response.write(Application["counter"].ToString());
This should work,if any problems please put on your comments
No comments:
Post a Comment