首先你的在数据库中保存你的文件名称,比如filename字段,然后可以这样:
Page.Response.Buffer=true;
Page.Response.Clear();
Page.Response.ContentType="Application/unknown";
Response.AddHeader("Content-Disposition","attachment; filename=" +
ds.Tables[0].Rows[0]["filename"].ToString() + ";");
Page.Response.BinaryWrite(file);
Page.Response.Flush();
Page.Response.End();
Page.Response.Buffer=true;
Page.Response.Clear();
Page.Response.ContentType="Application/unknown";
Response.AddHeader("Content-Disposition","attachment; filename=" +
ds.Tables[0].Rows[0]["filename"].ToString() + ";");
Page.Response.BinaryWrite(file);
Page.Response.Flush();
Page.Response.End();
解决方案 »
- js 获取控件值问题,急,在线等
- asp.net 创建新页面并跳转
- 求两个正则表达式
- 数据库中删除问题
- gridview 实现客户端编辑 最后统一保存
- 大家平时写Javascript语言的时候,都是用什么工具的呢?
- 求助高手DataGrid导为Excel的问题
- 装了vs.net之后,我原来的asp程序都不能用了,都出现如下错误,怎么解决?谢了
- FTP编程
- mvc4.0怎么做伪静态
- This sample demonstrates how to separately read XML schema and data into a DataSet, and bind the data to a DataGrid control
- datagrid怎样显示2个表的数据?
sttring strFileName="test.doc";
Response.AppendHeader("Content-Disposition","attachment; filename="+HttpUtility.UrlEncode(strFileName,System.Text.Encoding.UTF8));
Response.WriteFile(filePath);
Response.End();你的两个问题都可以这样解决
你既然会砍掉,那也一定会增加了
为什么不直接把word放在数据库中呢。