Example #1
0
        /// <summary>
        /// Processes the request.
        /// </summary>
        /// <param name="context">The context.</param>
        protected override void ProcessRequest(System.Web.HttpContext context)
        {
            if (this._blobInfo == null)
            {
                throw new BlobDownloadException(400, "Not found");
            }
            if (this._provider == null)
            {
                throw new BlobDownloadException(400, "Not found");
            }
            if (!(this._provider is S3StorageProvider))
            {
                throw new BlobDownloadException(400, "Not Found");
            }
            S3StorageProvider provider = (S3StorageProvider)_provider;
            S3Service         service  = provider.Service;
            string            url      = String.Empty;

            if (_AuthEnable)
            {
                url = service.GetAuthorizedUrl(provider.BucketName, this._blobInfo.Uid.ToString(), DateTime.UtcNow.Add(provider.ExpirationTimeSpan));
            }
            else
            {
                url = service.GetUrl(provider.BucketName, this._blobInfo.Uid.ToString());
            }

            context.Response.Redirect(url);
        }