Hide Copy Code
protected void Page_Load(object sender, EventArgs e) { Label4.Text = Session["us"].ToString(); if (!SM1.IsInAsyncPostBack) Session["timeout"] = DateTime.Now.AddMinutes(1).ToString(); }
and timer tick event code is :
protected void Timer1_Tick(object sender, EventArgs e)
{
DateTime timeout = DateTime.Parse(Session["timeout"].ToString());
DateTime now = DateTime.Now;
if (0 > DateTime.Compare(now, timeout))
{
TimeSpan ts = timeout - now;
int mins = ts.Minutes + 60 * ts.Hours; ;
int secs = ts.Seconds;
Label5.Text = String.Format("Time remaining: {0:D2} minutes {1:D2} seconds", mins, secs);
Hide Copy Code
} }
but now i wanted to do automatic redirect to second question page2 as will as timer stop. on the other words as first page timer become 0 minutes and 0 second it will redirect to second page
Nitin SharmaPosted Apr 4, 2015, 6:45 AM
Deepak SainiPosted Apr 3, 2015, 7:44 AM
in my point of you can use javascript for counter. i send u. and u can use window.location.href to redirect to another page on last time count.elp
and u can take help of this project.