窗口?下载的例子:System.IO.FileStream fs = System.IO.File.OpenRead( _FilePath );
byte[] FileData = new byte[ fs.Length ];
fs.Read( FileData, 0, ( int ) fs.Length );
Response.Clear();
Response.AddHeader( "Content-Type", "application/zip" );
string FileName = System.Web.HttpUtility.UrlEncode( System.Text.Encoding.UTF8.GetBytes( _FileName ) );
Response.AddHeader("Content-Disposition", "inline;filename="+ System.Convert.ToChar(34) + FileName + System.Convert.ToChar(34) );
Response.AddHeader("Content-Length", fs.Length.ToString() );
Response.BinaryWrite( FileData );
fs.Close();
System.IO.File.Delete( _FilePath );
byte[] FileData = new byte[ fs.Length ];
fs.Read( FileData, 0, ( int ) fs.Length );
Response.Clear();
Response.AddHeader( "Content-Type", "application/zip" );
string FileName = System.Web.HttpUtility.UrlEncode( System.Text.Encoding.UTF8.GetBytes( _FileName ) );
Response.AddHeader("Content-Disposition", "inline;filename="+ System.Convert.ToChar(34) + FileName + System.Convert.ToChar(34) );
Response.AddHeader("Content-Length", fs.Length.ToString() );
Response.BinaryWrite( FileData );
fs.Close();
System.IO.File.Delete( _FilePath );
解决方案 »
- GridView表头显示的问题
- 在Repeater中绑定的CheckBox服务器端控件
- postedfile对象错误,未能获取文件内容
- 为什么Decimal转换为Tostring自动给我加了两个00?
- 使用ClientScriptManager注册脚本时遇到个问题。怎么解决?
- 求救!求一个分页存储过程!
- 中文乱码,求救!
- 数学公式的求解!
- 字符串格式化问题,在线等待......
- 我升级了CrystalReport9.2,现在CrystalReportViewer不能往设计视图上拖放了,为什么?
- 模态对话框window.showModalDialog怎么触发父窗口的javascript事件?
- 怯怯地问一句:saucer(思归)到底是何方神圣?如此神通广大?
后面那个窗体是提示你是否要打开当前文件,这个是应该有的如何你不想要就选中它是否下载完后就关闭,那么就不会出现提示你是否要打开当前文件的提示啦.