I am checking the file exist in a folder but i am getting every time false. In that folder i have file.
code
-------
string filename = ((Label)e.Item.FindControl("Label2")).Text;
string filePath = @"Uploads\Master\MyDocsFiles\" + filename;
bool fileavail = File.Exists(filePath) ? true : false;
if (fileavail) {
Response.AddHeader("Content-Disposition", "attachment;filename=\"" + filePath + "\"");
Response.TransmitFile(Server.MapPath(filePath));
Response.End();
}
else
{
fileexist.Visible = true;
}
That is the code. Please give me the solution

Jignesh KumarRank #91 · 22.9K reputationPosted Nov 26, 2018, 6:54 PM EST
Kalyani ShevaleRank #1,111 · 1.7K reputationPosted Nov 26, 2018, 5:46 PM EST
Harish BatchuRank #6,801 · 256 reputationPosted Nov 26, 2018, 6:45 PM EST
Harish BatchuRank #6,801 · 256 reputationPosted Nov 26, 2018, 7:08 PM EST