Nitin Sharma

Nitin Sharma

  • NA
  • 154
  • 61.7k

how to move second page automatic after the time finish in a

Apr 3 2015 6:40 AM
i have an online exam project. and having some page for question. i was using this cod for question page1
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

Answers (2)