示例#1
0
        public async Task ShowImpl(String Base, String id, HttpResponseBase Response, Action <ExpandoObject> setParams, String suffix)
        {
            try
            {
                var url = $"/_attachment{Base}/{id}";
                var ai  = await _baseController.DownloadAttachment(url, setParams, suffix);

                if (ai == null)
                {
                    throw new RequestModelException($"Attachment not found. (Id:{id})");
                }
                Response.ContentType = ai.Mime;
                Response.BinaryWrite(ai.Stream);
            }
            catch (Exception ex)
            {
                _baseController.WriteHtmlException(ex, Response.Output);
            }
        }
示例#2
0
        async Task Attachment(String url)
        {
            try
            {
                AttachmentInfo info = await _baseController.DownloadAttachment(url, SetSqlQueryParams);

                if (info == null)
                {
                    return;
                }
                Response.ContentType = info.Mime;
                if (info.Stream == null)
                {
                    return;
                }
                Response.BinaryWrite(info.Stream);
            }
            catch (Exception ex)
            {
                _baseController.WriteHtmlException(ex, Response.Output);
            }
        }