Language Basics ASP.Net

<%@ Page Language="C#" %>

    void Page_Load()
    {
        if (!Page.IsPostBack)
            ResetStartTime();
    }
    
    void btnAgain_Click(Object sender, EventArgs e)
    {
        ResetStartTime();
    }
    
    void ResetStartTime()
    {
        Session["StartTime"] = DateTime.Now;
    }
    
    
    void valAnswer_ServerValidate(Object source, ServerValidateEventArgs args)
    {
        DateTime startTime = (DateTime)Session["StartTime"];
        if (startTime.AddSeconds(5) > DateTime.Now)
            args.IsValid = true;
        else
            args.IsValid = false;
    }



    Timed Test


    
    

    
    


    You have 5 seconds to answer the following question:
    


    
            id="lblQuestion"
        Text="What was Aristotle's first name?"
        AssociatedControlID="txtAnswer"
        Runat="server" />
    
            id="txtAnswer"
        Runat="server" />    
            id="valAnswer"
        Text="(You answered too slowly!)"
        OnServerValidate="valAnswer_ServerValidate"
        Runat="server"  />
    
    
    
            id="btnSubmit"
        Text="Submit"
        Runat="server" />
    
            id="btnAgain"
        Text="Try Again!"
        CausesValidation="false"
        OnClick="btnAgain_Click"
        Runat="server" />