Issue after downloading file in ASP.NET page
Hi all,
I am developing a sharepoint site using ASP.NET application.
In a ASP.NET page, iam downloading file from sqlserver db.
It works fine in ASP.NET application, but when i put into
sharepoint, it shows some problem.
The file gets downloaded but after clocking save,
open or cancel in save dilogbox,the page shows no response.
That is, no event has been occured like server button
click or anything.
The code i used is:
protected void lnkbtnDownload_Click(object sender, EventArgs e)
{
objEmployeeLeave.GetEMPSelectLeaveView(); //To load the file
string filename = "LeaveAttachDocument";
string name = "";
if (objEmployeeLeave.FileAttatchext == ".doc")
{
name = filename + ".doc";
}
else if (objEmployeeLeave.FileAttatchext == ".txt")
{
name = filename + ".txt";
}
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + file);
Response.AddHeader("Content-Length", file.Length.ToString());
Response.ContentType = "application/octet-stream";
//Response.BinaryWrite(objEmployeeLeave.FileAttatch) ;
Response.WriteFile(file.FullName);
Response.End();
}
Please view the above code and provide solution for this issue.I had searched in many sites.But i havent get clear solution.
Thank You all,
Subhashni Palanivel.
|