/// <summary>
        /// Gets the encrypted answer from form.
        /// </summary>
        /// <returns></returns>
        /// <exception type="CaptchaExpiredException">Thrown when the user takes too long to submit a captcha answer.</exception>
        protected virtual AnswerAndDate GetEncryptedAnswerFromForm()
        {
            string        formValue     = Page.Request.Form[HiddenEncryptedAnswerFieldName];
            AnswerAndDate answerAndDate = AnswerAndDate.ParseAnswerAndDate(formValue, CaptchaTimeout);

            if (answerAndDate.Expired)
            {
                throw new CaptchaExpiredException(Resources.CaptchaExpired_WaitedTooLong);
            }
            return(answerAndDate);
        }
        private bool ValidateCaptcha()
        {
            string        answer        = GetClientSpecifiedAnswer();
            AnswerAndDate answerAndDate = GetEncryptedAnswerFromForm();

            string expectedAnswer = answerAndDate.Answer;
            bool   isValid        = !String.IsNullOrEmpty(answer) &&
                                    String.Equals(answer, expectedAnswer, StringComparison.OrdinalIgnoreCase);

            return(isValid);
        }