create any class in your project.
put this static member in this class
public class AnyClass
{
public static int ind = 0;
public static string lastDay = "";
}
add your asp.net project a global.asax file
and configure your application_start and session_start area
protected void Application_Start(object sender, EventArgs e)
{
AnyClass.lastDay = DateTime.Now.ToShortDateString();
}
protected void Session_Start(object sender, EventArgs e)
{
string toDay = DateTime.Now.ToShortDateString();
if (DateTime.Now.Hour == 0 && (AnyClass.lastDay != toDay) && AnyClass.ind != 0)
{
AnyClass.ind = 0;
AnyClass.lastDay = toDay;
}
AnyClass.ind++;
}
dont forget this will took in session. you can manage your sessions time in web.config file or under iis.
call your AnyClass.ind in your project anywhere