예제 #1
0
파일: DownLoad.cs 프로젝트: sanxchen/MntApp
        public void Down(DownloadEventArgs e)
        {
            Console.WriteLine(BaseHelper.IsRemote);


            var file = this.OnDownloadFunc(e);

            try
            {
                HttpContext.Current.Response.ContentType = string.IsNullOrEmpty(file.ContentType) ? "application/x-excel" : file.ContentType;
                HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(file.FileName));
                HttpContext.Current.Response.WriteFile(Path.GetFullPath(file.FilePath));
            }
            catch (Exception)
            {
                throw new Exception("文件下载失败....");
            }
        }
예제 #2
0
파일: DownLoad.cs 프로젝트: sanxchen/MntApp
        protected virtual DownLoad OnDownloadFunc(DownloadEventArgs e)
        {
            DownLoadEventHander handler = DownloadFunc;

            return(handler?.Invoke(this, e));
        }