在chrome上怎么实现文件的下载? 在chrome上怎么实现文件的下载?我用window.open(url),<a href="url"></a>,都不能实现下载,都是打开,怎么办?求救!!!chrome下载 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 文件什么格式的?在IIS 上配置下 MIME 类型 应该就可以了。 音频,视频,图片,flash,要配置IIS? 那用户的机子上没有配置怎么办? public void downloadfile(string s_fileName) { HttpContext.Current.Response.ContentType = "application/ms-download"; string s_path = HttpContext.Current.Server.MapPath("~/") + s_fileName; System.IO.FileInfo file = new System.IO.FileInfo(s_path); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AddHeader("Content-Type", "application/octet-stream"); HttpContext.Current.Response.Charset = "utf-8"; HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(file.Name, System.Text.Encoding.UTF8)); HttpContext.Current.Response.AddHeader("Content-Length", file.Length.ToString()); HttpContext.Current.Response.WriteFile(file.FullName); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.End(); } 对的 每一种类型(例如:*.mv,*.rmvb,*.wv) 都要配置 MIME 类型IIS 配置了 就好下载了,客户不用配置。参考http://blog.csdn.net/csethcrm/article/details/7018417里边没有的 可以百度搜一下 关于sp1234回复的某个贴子 一个指向对象引用的变量,所占内存是多大,如何查出来,这样的变量所占内存都一样大吗? 求GridView自定义分页例子 请教:按一定格式读取字符串 先要做一个网络广告系统,如何实现多个广告(文字、图片或视频),按各自的播放时长(譬如说都播放5分钟)轮换播放? 猜猜看,i的最终结果会是什么呢?为什么? winform中datagrid中数据更改问题 DirectX9 SDK的文档有没有for C#的? 如何给自定义控件性设置图标? 请教关于字符集的问题???(在线等) C# datagridview 两个问题? WCF 服务开启问题
public void downloadfile(string s_fileName)
{
HttpContext.Current.Response.ContentType = "application/ms-download";
string s_path = HttpContext.Current.Server.MapPath("~/") + s_fileName;
System.IO.FileInfo file = new System.IO.FileInfo(s_path);
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Type", "application/octet-stream");
HttpContext.Current.Response.Charset = "utf-8";
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(file.Name, System.Text.Encoding.UTF8));
HttpContext.Current.Response.AddHeader("Content-Length", file.Length.ToString());
HttpContext.Current.Response.WriteFile(file.FullName);
HttpContext.Current.Response.Flush();
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.End();
}
对的 每一种类型(例如:*.mv,*.rmvb,*.wv) 都要配置 MIME 类型IIS 配置了 就好下载了,客户不用配置。参考
http://blog.csdn.net/csethcrm/article/details/7018417里边没有的 可以百度搜一下