Navigation Bar

Tuesday, May 26, 2009

File Download without href

string filePath=file Name with Server path;
System.IO.FileInfo obj = new System.IO.FileInfo(filePath);
Response.ClearHeaders();
Response.Clear();
//Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "attachment;filename=" + obj.Name);
//Response.TransmitFile(obj.FullName);
Response.WriteFile(obj.FullName);
Response.Flush();
Response.End();

No comments:

Post a Comment