Response.flush() not working file not downloading
Hai,Recently i m getting problem that bat file not downloading which was worked previously with as shown code below
========================================================
string filePath = "";
filePath = "E://ContractYarnIssue.bat";
FileInfo file = new System.IO.FileInfo(filePath);
if (file.Exists)
{
try
{
}
catch (Exception)
{
//handle the situation gracefully.
}
//return the file
string strFileExtName = strYarnIssueID + ".bat";
Context.Response.Clear();
Context.Response.AddHeader("Content-Disposition", "attachment; filename=" + strFileExtName);
Context.Response.AddHeader("Content-Length", file.Length.ToString());
Context.Response.ContentType = "application/octet-stream";
Context.Response.WriteFile(file.FullName);
Context.ApplicationInstance.CompleteRequest();
Context.Response.Flush();
Context.Response.Clear();
}
========================================================
Previously it work but now the file doest downloads,Can any one help ..
Regards
Vijay