H
hitendra15
Hi following is the code which sends file to the browser means user can
download file,
but the code generates error message Thread Being Aborted., will any
one put their thoughts
protected void SendFileToBrowser(string strpath)
{
try
{
FileInfo objFileInfo = new FileInfo(strpath);
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment;
filename=" + objFileInfo.Name);
Response.AddHeader("Content-Length",
objFileInfo.Length.ToString());
Response.WriteFile(objFileInfo.FullName);
Response.End();
}
catch (Exception ex)
{
Response.Write("");
}
}
Thanks
download file,
but the code generates error message Thread Being Aborted., will any
one put their thoughts
protected void SendFileToBrowser(string strpath)
{
try
{
FileInfo objFileInfo = new FileInfo(strpath);
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment;
filename=" + objFileInfo.Name);
Response.AddHeader("Content-Length",
objFileInfo.Length.ToString());
Response.WriteFile(objFileInfo.FullName);
Response.End();
}
catch (Exception ex)
{
Response.Write("");
}
}
Thanks