I have written a piece of code for downloading the file from the server. So when I download it, the file gets downloaded properly. But when I Open the document, it shows me error as.
Failed to load particular document.
Also while debugging I get error as.
'https:/NVMBD1BKH150V02.IN.RIL.COM/MWSiteSurveyDoc/I-KA-ANKL-ENB-0012_C2/180.jpg' is not a valid virtual path.
when I open the URL in browser, the file is opened properly.
Here is my code below
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());
}
}