我写了一段代码来从服务器下载文件。所以当我下载它时,文件会正确下载。但是当我打开文档时,它显示错误为。
无法加载特定文档。
同样在调试时我得到错误。
“https://NVMBD1BKH150V02.IN.RIL.COM/MWSiteSurveyDoc/I-KA-ANKL-ENB-0012_C2/180.jpg”不是有效的虚拟路径。
当我在浏览器中打开 URL 时,文件已正确打开。
这是我下面的代码
protected void lnkDownload_Click(object sender, EventArgs e)
{
try
{
string FulfilePath = (sender as LinkButton).CommandArgument;
string[] filePath = FulfilePath.Split('\\');
string path = @"" + ConfigurationManager.AppSettings["NASSServerPath_MW_Feasibility_Download"].ToString() + "/" + filePath[7] + "/" + filePath[8];
// Response.ContentType = ContentType;
Response.ContentType = ContentType;
Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(path));
Response.TransmitFile(path);
Response.End();
}
catch (Exception ex)
{
// objCom.ErrorLog(ex.GetType().ToString(), ex.Message, "Download Files", Session["UserName"].ToString());
}
}