Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 02, 2012 02:09 PM by andrewleighton657
Member
621 Points
192 Posts
Feb 02, 2012 11:19 AM|LINK
dear,
My hit counter is not stored and continue every day start from 1 but i want to start continue my code is below
protected void Page_Load(object sender, EventArgs e) {
if (Convert.ToDateTime(System.DateTime.Now.Date) != Convert.ToDateTime(Application["Date"])) { Application["activeusers"] = 0; Application["Date"] = System.DateTime.Now.Date; } else { Application["activeusers"] = Convert.ToInt32(Application["activeusers"]) + 1; } int i = Convert.ToInt32(Application["activeusers"]);
Response.Write(i.ToString()); }
219 Points
82 Posts
Feb 02, 2012 11:24 AM|LINK
For that you need to store your hit counter value in database.
and grad the latest value to display.
387 Points
196 Posts
Feb 02, 2012 02:09 PM|LINK
use xml, a simple text file that always maintains the correct user count
surjeet_kuma...
Member
621 Points
192 Posts
hit counter not stored and every day start from one what is the solution ?
Feb 02, 2012 11:19 AM|LINK
dear,
My hit counter is not stored and continue every day start from 1 but i want to start continue my code is below
protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToDateTime(System.DateTime.Now.Date) != Convert.ToDateTime(Application["Date"]))
{
Application["activeusers"] = 0;
Application["Date"] = System.DateTime.Now.Date;
}
else {
Application["activeusers"] = Convert.ToInt32(Application["activeusers"]) + 1;
}
int i = Convert.ToInt32(Application["activeusers"]);
Response.Write(i.ToString());
}
bhargav panc...
Member
219 Points
82 Posts
Re: hit counter not stored and every day start from one what is the solution ?
Feb 02, 2012 11:24 AM|LINK
For that you need to store your hit counter value in database.
and grad the latest value to display.
Bhargav Panchal
Please remember to click “Mark as Answer” on the post that helps you. This can be beneficial to other community members reading the thread.
andrewleight...
Member
387 Points
196 Posts
Re: hit counter not stored and every day start from one what is the solution ?
Feb 02, 2012 02:09 PM|LINK
use xml, a simple text file that always maintains the correct user count