下载界面的问题 我上传的文件,但是在浏览时,我想让它弹出对话框提示打开还是保存,我现在的程序是在浏览器上直接打开了,有的文件在浏览器中打开是浏览不了的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 "我想让它弹出对话框提示打开还是保存"当使用Response.BinaryWrite打开文件时,就会弹出对话框提示打开还是保存!如下:打开一个存储在数据库image字段的doc文档, sqlConnection1.Open(); int id = 5; sqlCommand1.Connection = sqlConnection1; sqlCommand1.CommandText = "select * from ImageStore where ImageId = "+ id ; sqlDataAdapter1.SelectCommand = sqlCommand1; sqlDataAdapter1.Fill(dataSet11,"ImageStore"); string FileName = "Temp.doc"; Response.AddHeader("Content-Disposition", "attachment;FileName=" + System.Web.HttpUtility.UrlEncode(FileName));//System.Web.HttpUtility.UrlEncode(System.Text.Encoding.Default.GetBytes( FileName))); Response.Charset ="GB2312"; Response.ContentEncoding =System.Text.Encoding.GetEncoding("GB2312"); Response.ContentType = dataSet11.Tables["ImageStore"].Rows[0]["ImageContentType"].ToString(); Response.BinaryWrite((Byte[])dataSet11.Tables["ImageStore"].Rows[0]["ImageData"]); sqlConnection1.Close(); asp.net图片上传的问题。求助大家! 点击事件没被触发 这里人气高,问个Silverlight问题 AspJpeg如何去掉图片白色背景? 这种控件叫什么名字? 好好的,怎么今天开机后打不开原来的项目了? C#和VB.net的兼容 很多类似的问题ASP/asp.net求解! 100分求web项目如何发布到网站? 请教各位如何让datagrid自动换行!!!(在线等待) [Asp.net]请问在DataGrid分页时,如何保存CheckBox模板列里的值 在treeview默认的属性下。修改那个属性可以把+号上的鼠标变成手形?谢谢!
当使用Response.BinaryWrite打开文件时,就会弹出对话框提示打开还是保存!
如下:打开一个存储在数据库image字段的doc文档,
sqlConnection1.Open();
int id = 5;
sqlCommand1.Connection = sqlConnection1;
sqlCommand1.CommandText = "select * from ImageStore where ImageId = "+ id ;
sqlDataAdapter1.SelectCommand = sqlCommand1;
sqlDataAdapter1.Fill(dataSet11,"ImageStore");
string FileName = "Temp.doc";
Response.AddHeader("Content-Disposition", "attachment;FileName=" + System.Web.HttpUtility.UrlEncode(FileName));//System.Web.HttpUtility.UrlEncode(System.Text.Encoding.Default.GetBytes( FileName)));
Response.Charset ="GB2312";
Response.ContentEncoding =System.Text.Encoding.GetEncoding("GB2312");
Response.ContentType = dataSet11.Tables["ImageStore"].Rows[0]["ImageContentType"].ToString();
Response.BinaryWrite((Byte[])dataSet11.Tables["ImageStore"].Rows[0]["ImageData"]); sqlConnection1.Close();