0

我在服务器上有一个网站。它有一个按钮,可以触发从该服务器下载文件(.zip/.doc)。但它并不指向该文件夹/文件。这个问题怎么解决??

它在这个特定文件上失败了......

public static bool ResponseFile(HttpRequest _Request, HttpResponse _Response, string _fileName, string _fullPath, long _speed){
FileStream myFile = new FileStream(_fullPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
}
4

1 回答 1

0

我没有尝试过你的代码,但这似乎对我有用。您可以使其余部分动态化。

string FileName = "test.zip";
string PathFile = "C:\project\download\test.zip";
var fileInfo = new System.IO.FileInfo(PathFile);
Response.ContentType = "application/zip";
Response.AddHeader("Content-Disposition", String.Format("attachment;filename=\"{0}\"", FileName));
Response.AddHeader("Content-Length", fileInfo.Length.ToString());
Response.WriteFile(PathFile);
Response.End();
于 2012-10-04T09:38:48.043 回答