文件下载 获取远程图片
//response.setHeader("Content-disposition","inline; filename=test1.doc"); //线上浏览方式,用IE打开 response.setHeader("Content-disposition", "attachment; filename=test1.doc");//下载方式,下载,不用浏览器打开 Response.ContentType = "application/octet-stream"; Response.AddHeader("Content-disposition", "attachment; filename=ciwong.doc"); string strDoc = this.RenderView("View", new Examination.Mapping.Entities.Examination() { ExaminationID = id }); Response.ContentType = "application/ms-doc"; Response.Write(strDoc); Response.Flush(); Response.End(); Response.Close();
//下载远程图片
public static System.Drawing.Image DownImg(string url) { WebRequest wreq = WebRequest.Create(url); wreq.Timeout = 10000; HttpWebResponse wresp = (HttpWebResponse)wreq.GetResponse(); Stream s = wresp.GetResponseStream(); System.Drawing.Image img = System.Drawing.Image.FromStream(s); img.Save(filename, ImageFormat.Jpeg); img.Dispose(); s.Dispose(); return img; }
//response.setHeader("Content-disposition","inline; filename=test1.doc"); //线上浏览方式,用IE打开
response.setHeader("Content-disposition", "attachment; filename=test1.doc");//下载方式,下载,不用浏览器打开
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-disposition", "attachment; filename=ciwong.doc");
string strDoc = this.RenderView("View", new Examination.Mapping.Entities.Examination() { ExaminationID = id });
Response.ContentType = "application/ms-doc";
Response.Write(strDoc);
Response.Flush();
Response.End();
Response.Close();
一只站在树上的鸟儿,从来不会害怕树枝会断裂,因为它相信的不是树枝,而是它自己的翅膀。与其每天担心未来,不如努力做好现在。