Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.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_Visual Studio 2012_Asp.net 4.5_Iis 8 - Fatal编程技术网

Asp.net 某些站点不允许两次请求同一文件

Asp.net 某些站点不允许两次请求同一文件,asp.net,visual-studio-2012,asp.net-4.5,iis-8,Asp.net,Visual Studio 2012,Asp.net 4.5,Iis 8,我将为用户设置下载,但在使用此代码时: Response.Clear(); Response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Disposition", "attachment; filename=" + FileName + ".pdf"); Response.WriteFile(Server.MapPath(@"Resumes\" + FileName + ".pdf")); Resp

我将为用户设置下载,但在使用此代码时:

Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + FileName + ".pdf");
Response.WriteFile(Server.MapPath(@"Resumes\" + FileName + ".pdf"));
Response.End();
string filename = FileName + ".pdf";
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + filename);
string aaa = Server.MapPath("~/Resumes/" + filename);
Response.TransmitFile(Server.MapPath("~/Resumes/" + filename));
Response.End();
此错误将显示:

当我使用此代码时:

Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + FileName + ".pdf");
Response.WriteFile(Server.MapPath(@"Resumes\" + FileName + ".pdf"));
Response.End();
string filename = FileName + ".pdf";
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + filename);
string aaa = Server.MapPath("~/Resumes/" + filename);
Response.TransmitFile(Server.MapPath("~/Resumes/" + filename));
Response.End();
此错误将显示:

当我试图用浏览器下载文件时,它完全下载,没有任何错误,但IDM显示这些错误


我正在使用asp.net 4.5和IIS 8。我试过这段代码,看起来效果不错。但我在任何网站上都没有看到这段代码用于文件下载,所以我不确定我做得是否正确。无论如何,它是工作

Response.RedirectPermanent("http://MySite.com/Resumes/" + FileName + ".pdf");

我试过这个代码,看起来效果不错。但我在任何网站上都没有看到这段代码用于文件下载,所以我不确定我做得是否正确。无论如何,它是工作

Response.RedirectPermanent("http://MySite.com/Resumes/" + FileName + ".pdf");

建议您尝试在“选项->下载”对话框中启用“显示时立即开始下载…”选项。我不知道这是否有助于找出问题的根源。这对我没有帮助。我无法更改所有客户端PC中的IDM设置!!!我建议所有下载管理器都有这个问题。我更改了IDM设置,但仍然有这些错误。我认为IIS有问题,因为在我的pc和localhost中,它运行良好,但在服务器上不工作。我同意,这听起来像是IDM发出请求的方式和服务器配置如何处理这些请求的组合。我怀疑服务器正在向IDM发出一个唯一的会话,并试图阻止多个同时请求。我个人没有必要解决这样的问题。建议您尝试在“选项->下载”对话框中启用“显示时立即开始下载…”选项。我不知道这是否有助于找出问题的根源。这对我没有帮助。我无法更改所有客户端PC中的IDM设置!!!我建议所有下载管理器都有这个问题。我更改了IDM设置,但仍然有这些错误。我认为IIS有问题,因为在我的pc和localhost中,它运行良好,但在服务器上不工作。我同意,这听起来像是IDM发出请求的方式和服务器配置如何处理这些请求的组合。我怀疑服务器正在向IDM发出一个唯一的会话,并试图阻止多个同时请求。我个人没有必要解决这样的问题。