如果只是链接到一个下载地址不是所有的文件都能够下载的给你一个下载的方法:
///
///
下载方法
///
///
name="filePath">下载路径
private
void
Download(string
filePath)
{
FileInfo
file
=
new
FileInfo(filePath);
Response.ContentEncoding
=
System.Text.Encoding.GetEncoding("UTF-8");
//解决中文乱码
Response.AddHeader("Content-Disposition",
"attachment;
filename="
+
Server.UrlEncode(file.Name));
//解决中文文件名乱码
Response.AddHeader("Content-length",
file.Length.ToString());
Response.ContentType
=
"appliction/octet-stream";
Response.WriteFile(file.FullName);
Response.End();
}
必须要跟上你的IP地址才行。
你的是什么文件,不是所有的文件都可以直接通过链接下载的。