Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net 服务器未指向文件夹_Asp.net - Fatal编程技术网

Asp.net 服务器未指向文件夹

Asp.net 服务器未指向文件夹,asp.net,Asp.net,我在服务器上有一个网站。它有一个按钮,用于触发从该服务器下载文件(.zip/.doc)。 但它并没有指向那个文件夹/文件。如何解决这个问题 它在这个特定的文件中失败 public static bool ResponseFile(HttpRequest _Request, HttpResponse _Response, string _fileName, string _fullPath, long _speed){ FileStream myFile = new FileStream(_ful

我在服务器上有一个网站。它有一个按钮,用于触发从该服务器下载文件(.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);
}

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

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();

即使我们无法解决此问题,也必须查看您的代码。我的应用程序在本地主机上运行时可以下载本地系统上可用的文件…但在服务器上上载时使用相同的应用程序…它不起作用…所以我猜编码不是一个issuepop-up拦截器还是什么?或浏览器与代码的兼容性。可能是不同。它以前工作…突然停止…在所有主要浏览器中尝试…没有弹出块。。