/// <summary>
        /// Queue validation
        /// </summary>
        /// <remarks>
        /// Please be aware that this this implementation is not done on error handling pages (e.g. Error.aspx) which will cause users to get looped arround.
        /// </remarks>
        protected override void OnPreInit(EventArgs e)
        {
            try
            {
                IKnownUser knownUser = KnownUserFactory.VerifyMd5Hash();

                if (knownUser == null)
                    Response.Redirect("Link.aspx");

                if (knownUser.TimeStamp < DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(3)))
                    Response.Redirect("Link.aspx");

                PersistModel model = new PersistModel(
                    knownUser.QueueId,
                    knownUser.PlaceInQueue,
                    knownUser.TimeStamp);

                model.Persist();
            }
            catch (KnownUserException ex)
            {
                UriBuilder targetUrl = new UriBuilder(Request.Url);
                targetUrl.Path = "Link.aspx";

                Response.Redirect("Error.aspx?queuename=link&t=" + HttpUtility.UrlEncode(targetUrl.Uri.AbsoluteUri));
            }

            base.OnPreInit(e);
        }
        /// <summary>
        /// Queue validation
        /// </summary>
        /// <remarks>
        /// Please be aware that this this implementation is not done on error handling pages (e.g. Error.aspx) which will cause users to get looped arround.
        /// </remarks>
        protected override void OnPreInit(EventArgs e)
        {
            try
            {
                IKnownUser knownUser = KnownUserFactory.VerifyMd5Hash();

                if (knownUser == null)
                {
                    Response.Redirect("Link.aspx");
                }

                if (knownUser.TimeStamp < DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(3)))
                {
                    Response.Redirect("Link.aspx");
                }

                PersistModel model = new PersistModel(
                    knownUser.QueueId,
                    knownUser.PlaceInQueue,
                    knownUser.TimeStamp);

                model.Persist();
            }
            catch (KnownUserException ex)
            {
                UriBuilder targetUrl = new UriBuilder(Request.Url);
                targetUrl.Path = "Link.aspx";

                Response.Redirect("Error.aspx?queuename=link&t=" + HttpUtility.UrlEncode(targetUrl.Uri.AbsoluteUri));
            }

            base.OnPreInit(e);
        }
        /// <summary>
        /// Queue validation
        /// </summary>
        /// <remarks>
        /// Please be aware that this this implementation is not done on error handling pages (e.g. Error.aspx) which will cause users to get looped arround.
        /// </remarks>
        private void QueueITValidation()
        {
            try
            {
                this._result = SessionValidationController.ValidateRequest(QueueFactory.CreateQueue("advanced"));
                var enqueue = this._result as EnqueueResult;

                // Check if user must be enqueued (new users)
                if (enqueue != null)
                {
                    if (QueueIsHealthy(enqueue.Queue))     //Is Queue-it service online for my queue?
                    {
                        Response.Redirect(enqueue.RedirectUrl);
                    }
                }

                // This part checks if user has been through the queue and persists the users queue details for later tracking
                var accepted = this._result as AcceptedConfirmedResult;
                if (accepted != null)
                {
                    if (!accepted.IsInitialValidationRequest)
                    {
                        return;     // data has already been persisted
                    }
                    PersistModel model = new PersistModel(
                        accepted.Queue.CustomerId,
                        accepted.Queue.EventId,
                        accepted.KnownUser.QueueId,
                        accepted.KnownUser.PlaceInQueue,
                        accepted.KnownUser.TimeStamp);

                    model.Persist();     //Persist users queue details
                }
            }
            catch (ExpiredValidationException ex)
            {
                // Known user has has expired - Show error page and use GetCancelUrl to get user back in the queue
                Response.Redirect("Error.aspx?queuename=advanced&t=" + HttpUtility.UrlEncode(ex.KnownUser.OriginalUrl));
            }
            catch (KnownUserValidationException ex)
            {
                // The known user url or hash is not valid - Show error page and use GetCancelUrl to get user back in the queue
                Response.Redirect("Error.aspx?queuename=advanced&t=" + HttpUtility.UrlEncode((ex.InnerException as KnownUserException).OriginalUrl));
            }
        }
        /// <summary>
        /// Queue validation
        /// </summary>
        /// <remarks>
        /// Please be aware that this this implementation is not done on error handling pages (e.g. Error.aspx) which will cause users to get looped arround.
        /// </remarks>
        private void QueueITValidation()
        {
                try
                {
                    this._result = SessionValidationController.ValidateRequest(QueueFactory.CreateQueue("advanced"));
                    var enqueue = this._result as EnqueueResult;

                    // Check if user must be enqueued (new users)
                    if (enqueue != null)
                    {
                        if (QueueIsHealthy(enqueue.Queue)) //Is Queue-it service online for my queue?
                            Response.Redirect(enqueue.RedirectUrl);
                    }

                    // This part checks if user has been through the queue and persists the users queue details for later tracking
                    var accepted = this._result as AcceptedConfirmedResult;
                    if (accepted != null)
                    {
                        if (!accepted.IsInitialValidationRequest)
                            return; // data has already been persisted

                        PersistModel model = new PersistModel(
                            accepted.Queue.CustomerId,
                            accepted.Queue.EventId,
                            accepted.KnownUser.QueueId,
                            accepted.KnownUser.PlaceInQueue,
                            accepted.KnownUser.TimeStamp);

                        model.Persist(); //Persist users queue details
                    }
                }
                catch (ExpiredValidationException ex)
                {
                    // Known user has has expired - Show error page and use GetCancelUrl to get user back in the queue
                    Response.Redirect("Error.aspx?queuename=advanced&t=" + HttpUtility.UrlEncode(ex.KnownUser.OriginalUrl));
                }
                catch (KnownUserValidationException ex)
                {
                    // The known user url or hash is not valid - Show error page and use GetCancelUrl to get user back in the queue
                    Response.Redirect("Error.aspx?queuename=advanced&t=" + HttpUtility.UrlEncode((ex.InnerException as KnownUserException).OriginalUrl));
                }
        }