虚拟主机域名注册-常见问题其他问题 → 其他问题


[原创][22SEO技术网]asp.net读取word文档,然后通过页面进行下载-mssql
作者:系统管理员

以下内容仅代表本人观点:http://www.joceancloud.com
http://blog.jrj.com.cn/7175997176,9861008a.html云主机 

string path = Server.MapPath("~/dm.doc");
FileInfo file = new FileInfo(path);
FileStream myfs = new FileStream(path, FileMode.Open, FileAccess.Read);
byte[] filedata = new byte[file.Length];
myfs.Read(filedata, 0, (int)file.Length);
myfs.Close();
Response.Clear();
Response.ContentEncoding = Encoding.GetEncoding("GB2312");
Response.Charset = "GB2312";
Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(file.Name));
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/msword";
Response.Flush();
Response.BinaryWrite(filedata);
Response.End();
http://www.joceancloud.comhttp://blog.jrj.com.cn/7421784692,9888226a.html
原文转自杰森云数码:http://www.joceancloud.com
免费虚拟主机22US数码:http://windows.joceancloud.com
便宜空间:http://www.22new.net


来源:
阅读:3638
日期:2013-01-11

【 双击滚屏 】 【 推荐朋友 】 【 收藏 】 【 打印 】 【 关闭 】 【 字体: 】 
上一篇:[原创][22SEO技术网]网站编辑所需要的SEO知识 提高整体优化效果-云主机
下一篇:[原创]关于linux服务器用ftp通过ssh传输文件
  >> 相关文章