日期:2014-05-19  浏览次数:20415 次

根据文件下载的地址直接下载的困惑 求助
网上的列子多是需要文件地址直接将文件名写上的   比如:http://dl_dir.qq.com/qqfile/qq2007beta1kb5.exe

但是我需要的不是这样子  
而是像这样:
http://count.crsky.com/view_down.asp?down_url=http://5.shdx1.crsky.com/200704/WebThunder-v1.7.2.107.rar&downd_id=13&ID=24731&down=yes
根据上面的地址来下载

谁有详细的代码   帮我解决下啊   谢谢啦   分再不够   我再加   已经发了一个100了   没人理

http://community.csdn.net/Expert/topic/5487/5487545.xml?temp=.6552698

------解决方案--------------------
很想帮你,可惜对这个不怎么懂
------解决方案--------------------
.net 下 下载 相关的函数

http://blog.csdn.net/hertcloud/archive/2007/03/22/1537371.aspx
------解决方案--------------------
http://count.crsky.com/view_down.asp?down_url=http://5.shdx1.crsky.com/200704/WebThunder-v1.7.2.107.rar&downd_id=13&ID=24731&down=yes

真正起作用的是:http://5.shdx1.crsky.com/200704/WebThunder-v1.7.2.107.rar&downd_id=13&ID=24731&down=yes
获取这后面的参数就行了。
------解决方案--------------------
简单点从querystring取得文件的url,然后redirect过去
------解决方案--------------------
在ReRose.aspx页面里,获取 传过来的id,根据id,从数据库查询对应的文件的地址,然后转过去就行了。
------解决方案--------------------
你直接把其他网站的下载URL拷到你的代码里不就行了?
真不清楚你到底要搞干什么
------解决方案--------------------
http://5.shdx1.crsky.com/200704/WebThunder-v1.7.2.107.rar&downd_id=13&ID=24731&down=yes

本站开启了防盗链接功能...

不管你怎么写,下载的时候只需文件路径
------解决方案--------------------
public void downLoad(string path)
{
try
{
string filePath = path;
int temp = filePath.LastIndexOf( "/ ") + 1;
string fileName = filePath.Substring(temp, filePath.Length - temp);
FileStream fileStream = new FileStream(Server.MapPath(filePath), FileMode.Open, FileAccess.Read, FileShare.Read);
long fileSize = fileStream.Length;
Context.Response.ContentType = "application/octet-stream ";
Context.Response.AddHeader( "Content-Disposition ", "attachment; filename=\ " " + HttpUtility.UrlEncode(fileName, System.Text.Encoding.UTF8) + "\ " ");
Context.Response.AddHeader( "Content-Length ", fileSize.ToString());
byte[] fileBuffer = new byte[fileSize];
fileStream.Read(fileBuffer, 0, (int)fileSize);
fileStream.Close();
Context.Response.BinaryWrite(fileBuffer);
Context.Response.End();
}
catch
{
Response.Write( " <script> alert( '查无此资料或已被删除 '); </script> ");
}
}