asp net error该进程因为正在使用而无法访问该文件

时间:2016-04-25 06:46:06

标签: c# asp.net web

关于上述主题,我有一个错误,基本上我只是从其路径下载文件。我的下载代码是:

[323, 456, 654, 1, 34, 33, 45, 5432, 34566]

我必须多次刷新页面才能下载该项目,但我在行string sFile = Request.QueryString["RFBNumber"].ToString(); string sFile2 = Request.QueryString["FolderName"].ToString(); string sFlag = Request.QueryString["Flag"].ToString(); //CreateRFBReport(sFile, sFile2); //CreateSingleFile(sFile2, sFile); if (sFlag == "1") { sFilename = "RFB_" + sFile + "_COLLATED.PDF"; sGlobalFolderName = sFile2; sFilePath = @ "" + sGlobalFolderName + "\\" + sFilename; WebClient client = new WebClient(); byte[] buff = client.DownloadData(sFilePath); Response.ContentType = "application/pdf"; Response.AddHeader("content-length", buff.Length.ToString()); Response.BinaryWrite(buff); } if (sFlag == "2") { sFilename = "SOP_" + sFile + "_COLLATED.PDF"; sGlobalFolderName = sFile2; sFilePath = @ "" + sGlobalFolderName + "\\" + sFilename; WebClient client = new WebClient(); byte[] buff = client.DownloadData(sFilePath); Response.ContentType = "application/pdf"; Response.AddHeader("content-length", buff.Length.ToString()); Response.BinaryWrite(buff); }

时遇到错误

有人能帮帮我吗?一直在寻找解决这个问题的方法。提前谢谢。

0 个答案:

没有答案