标签:style blog io color ar os 使用 sp 文件
最好使用aspx页面写:
1 protected void Page_Load(object sender,EventArgs e) 2 { 3 if(!IsPostBack) 4 { 5 System.Io.FileStream myFileStream = new System.Io.FileStream(Server.MapPath("",System.Io.FileMode.Open)); 6 long FileSize; 7 FileSize = myFileStream.Length; 8 byte[] Buffer = new byte[(int)FileSize]; 9 myFileStream.Read(Buffer,0,(int)myFileStream.Length); 10 myFileStream.Close(); 11 12 Response.Clear(); 13 Response.ClearHeaders(); 14 Response.Content(); 15 Response.ContentType = "image/png"; 16 Response.AddHeader("content-disposition","attachment:filename="+"文件名.png",System.Text.Encoding.UTF8) 17 Response.BinaryWrite(Buffer ); 18 } 19 }
标签:style blog io color ar os 使用 sp 文件
原文地址:http://www.cnblogs.com/Darker-Samuel/p/4104165.html