直接让数据流下载,而不是显示在页面上.当然也不能在硬盘上创建这个文件,这该咋办呢?
解决方案 »
- 百度创意专家是用何种技术来实现的?
- 如何避免Dropdrowlist中的重复数据
- qiuzhu
- IIS里无法打开asp.NET网站
- 关于型如 http://123.com/cn 这样的网站结构问题
- 请问sqlcommand或sqldataadapter中是否有判断select结果行数的属性
- 业务逻辑层和表示层具体该怎么分离才好??--100分!
- 如何设置可以在访问Reporting Service报表时不弹出登陆窗口,而直接查看
- 请教Crystal Reports的问题
- 那儿有支持vs.net 2003的IIS?
- 查询问题(做一个查询,用母表,默认查当月的那一个表.)
- 我有这样一个存储过程 请问
Response.BinaryWrite(encoding.GetBytes(yourStr));
Response.Charset = "GB2312";
Response.End();
Response.Close();
Response.Clear();
Response.AddHeader("Content-Disposition","attachment;filename="+file.Name);
Response.AddHeader("Content-Length",file.Length.ToString());
Response.ContentType="application/octet-stream";
Response.WriteFile(文件路径);
Response.End();
我是从数据库直接读流,没有"文件路径"啊!
Response.ContentType="application/x-www-form-urlencoded";
Response.AppendHeader("Content-disposition","attachment; filename="+HttpUtility.UrlEncode(filename));
Response.BinaryWrite(t);
Response.End();
Response.Clear();
//文件类型
Response.ContentType = a.ContentType;
//文件的二进制数据
Response.BinaryWrite(a.ContentBytes);
Response.End();
Response.Close();
图片直接会在页面上显示,ZIP等文件的话,会弹出下载对话框,但文件类型却是ASPX!!
怎么让它弹出正确的文件类型下载??
问题解决了.