예제 #1
0
        public override void SetValidationResult(IQueue queue, IValidateResult validationResult, DateTime?expirationTime = null)
        {
            AcceptedConfirmedResult acceptedResult = validationResult as AcceptedConfirmedResult;

            if (acceptedResult != null)
            {
                var key = GenerateKey(queue.CustomerId, queue.EventId);
                SessionStateModel model = new SessionStateModel()
                {
                    QueueId      = acceptedResult.KnownUser.QueueId,
                    OriginalUri  = acceptedResult.KnownUser.OriginalUrl,
                    PlaceInQueue = acceptedResult.KnownUser.PlaceInQueue,
                    TimeStamp    = acceptedResult.KnownUser.TimeStamp,
                    RedirectType = acceptedResult.KnownUser.RedirectType,
                };

                if (expirationTime != null)
                {
                    model.Expiration = expirationTime;
                }
                else if (acceptedResult.KnownUser.RedirectType == RedirectType.Idle)
                {
                    model.Expiration = DateTime.UtcNow.Add(IdleExpiration);
                }
                else if (!ExtendValidity)
                {
                    model.Expiration = DateTime.UtcNow.AddMinutes(HttpContext.Current.Session.Timeout);
                }

                HttpContext.Current.Session[key] = model;
            }
        }
예제 #2
0
        public override IValidateResult GetValidationResult(IQueue queue)
        {
            var key = GenerateKey(queue.CustomerId, queue.EventId);
            SessionStateModel model = HttpContext.Current.Session[key] as SessionStateModel;

            if (model == null)
            {
                return(null);
            }
            if (model.Expiration.HasValue && model.Expiration < DateTime.UtcNow)
            {
                return(null);
            }

            return(new AcceptedConfirmedResult(
                       queue,
                       new Md5KnownUser(
                           model.QueueId,
                           model.PlaceInQueue,
                           model.TimeStamp,
                           queue.CustomerId,
                           queue.EventId,
                           model.RedirectType,
                           model.OriginalUri),
                       false));
        }
        public override void SetValidationResult(IQueue queue, IValidateResult validationResult, DateTime? expirationTime = null)
        {
            AcceptedConfirmedResult acceptedResult = validationResult as AcceptedConfirmedResult;

            if (acceptedResult != null)
            {
                var key = GenerateKey(queue.CustomerId, queue.EventId);
                SessionStateModel model = new SessionStateModel()
                {
                    QueueId = acceptedResult.KnownUser.QueueId,
                    OriginalUri = acceptedResult.KnownUser.OriginalUrl,
                    PlaceInQueue = acceptedResult.KnownUser.PlaceInQueue,
                    TimeStamp = acceptedResult.KnownUser.TimeStamp,
                    RedirectType = acceptedResult.KnownUser.RedirectType,
                };

                if (expirationTime != null)
                    model.Expiration = expirationTime;
                else if (acceptedResult.KnownUser.RedirectType == RedirectType.Idle)
                    model.Expiration = DateTime.UtcNow.Add(IdleExpiration);
                else if (!ExtendValidity)
                    model.Expiration = DateTime.UtcNow.AddMinutes(HttpContext.Current.Session.Timeout);

                HttpContext.Current.Session[key] = model;
            }
        }