小马的天空
我为软狂

导航

 

有的时候我们不想让用户直接在IE中打开已知类型的文件,比如Word,而希望能直接下载,这时候可用下面代码来替换Response.Redirect

Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment;FileName="+YourFileName);
Response.BinaryWrite((byte[])YourFileData.Rows[0]["AttachmentContent"]);
Response.End();

posted on 2006-08-07 14:30  Vinson  阅读(151)  评论(0)    收藏  举报