Hi Use the below code
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=IT-PC;Initial Catalog=collegeDB;User ID=sa; Password=12345;");
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "Select timeupdate from timeLastUpdate";
DateTime lastupdatetime;
using (con)
{
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
if (reader.Read())
{
lastupdatetime = Convert.ToDateTime(reader["timeupdate "].ToString());
lblUpdate.Text = lastupdatetime.ToString();
lblUpdate.ForeColor = Color.Red;
}
}
if(lastupdatetime.AddMinutes(5) > DateTime.Now)
{
Response.Redirect("HomePage.aspx");
}
else
{
Response.Redirect("underconstruction.aspx");
}
}
Also you should clean all the resources.