网页实现下载 如我把要下载的文件放在服务器上,www.xxxxx.com/123.mp4 这样打开,报404错误,我想把这个文件(还有其他格式等等)直接下载,如何实现或是哪里设置。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 写一个链接<a></a>指向那个文件就可以吧 iis上设置了可以有.mp4 文件类型吗,没有就要指定。还有,不知道你为什么想要搞这种下载模式,直接用ftp不就完事了吗! protected void xiazai_Click(object sender, EventArgs e) { string path = Server.MapPath(DownloadURL);//path为服务器存放文件的路径 FileDownload(path); } private void FileDownload(string FullFileName) { System.IO.FileInfo DownloadFile = new System.IO.FileInfo(FullFileName); Response.Clear(); Response.ClearHeaders(); Response.Buffer = false; Response.ContentType = "application/octet-stream"; Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(DownloadFile.FullName, System.Text.Encoding.UTF8)); Response.AppendHeader("Content-Length", DownloadFile.Length.ToString()); Response.WriteFile(DownloadFile.FullName); Response.Flush(); Response.End(); } protected void xiazai_Click(object sender, EventArgs e){string path = Server.MapPath(DownloadURL);//path为服务器存放文件的路径 FileDownload(path); asp.net 使用百度、谷歌搜索引擎 gridview前台没显示。。。 模板列里控件调用JS [求助]关于URL重写问题 关于在线支付的(Pay Pal Pro) HTML中frameSet的问题 有点难度的问题,高手的话不妨近来看看?散100分 如何在ASP。NEt页面中在状态栏实现跑马灯? 关于日历控件的问题.. 在线给分.. 帮帮忙,谢谢:) 我想把一个在Winform里创建的用户控件 在ASP页面里使用 求助! 这个效果怎么实现?
protected void xiazai_Click(object sender, EventArgs e)
{
string path = Server.MapPath(DownloadURL);//path为服务器存放文件的路径
FileDownload(path);
}
private void FileDownload(string FullFileName)
{
System.IO.FileInfo DownloadFile = new System.IO.FileInfo(FullFileName);
Response.Clear();
Response.ClearHeaders();
Response.Buffer = false;
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + HttpUtility.UrlEncode(DownloadFile.FullName, System.Text.Encoding.UTF8));
Response.AppendHeader("Content-Length", DownloadFile.Length.ToString());
Response.WriteFile(DownloadFile.FullName);
Response.Flush();
Response.End();
}
{
string path = Server.MapPath(DownloadURL);//path为服务器存放文件的路径
FileDownload(path);