예제 #1
0
        /// <summary>响应</summary>
        /// <param name="context"></param>
        /// <param name="attachment"></param>
        /// <param name="stream"></param>
        /// <param name="dispositionMode"></param>
        protected virtual void OnResponse(HttpContext context, IAttachment attachment, Stream stream, String dispositionMode)
        {
            var wd = new WebDownload();

            wd.Stream   = stream;
            wd.FileName = attachment.FileName;
            if (!String.IsNullOrEmpty(dispositionMode))
            {
                wd.Mode = WebDownload.ParseMode(dispositionMode);
            }
            if (!String.IsNullOrEmpty(attachment.ContentType))
            {
                wd.ContentType = attachment.ContentType;
            }

            if (BrowserCache)
            {
                wd.BrowserCache       = true;
                wd.ModifyTime         = attachment.UploadTime;
                wd.BrowserCacheMaxAge = BrowserCacheMaxAge;
            }

            OnReader(wd);
            wd.Render();
        }