protected void Page_Load(object sender, EventArgs e) { // Check if user has authorization. if (!Context.User.Identity.IsAuthenticated && Context.Session["UserID"] != null) { Response.Redirect("Login.aspx"); } if (!IsPostBack) { // Validate Query string value. Validation(); LessonID = Convert.ToInt32(Request.QueryString["ID"]); ViewState["lessonID"] = LessonID; UserID = Convert.ToInt32(Context.Session["UserID"]); StopWatch = new Stopwatch(); StopWatch.Start(); // Get the questions related to this lesson. QuestionBL questionBL = new QuestionBL(); // Get the list of questions. Questions = questionBL.GetQuestionsByLessonID(LessonID); // Bind questions to views. BindQuestions(); } else { LessonID = Convert.ToInt32(ViewState["lessonID"]); UserID = Convert.ToInt32(Context.Session["UserID"]); // Store selections made. StoreSelections(); } }