public bool ReturnXls(System.Web.HttpResponse resp, string fileName)
{
System.IO.FileInfo f = new System.IO.FileInfo(fileName);
resp.ClearHeaders();
resp.ClearContent();
DialogUtils.SetCookieResponse(resp);
resp.HeaderEncoding = System.Text.Encoding.Default;
resp.AddHeader("Content-Disposition", "attachment; filename=" + f.Name);
resp.AddHeader("Content-Length", f.Length.ToString());
resp.ContentType = "application/octet-stream";
resp.Cache.SetCacheability(HttpCacheability.NoCache);
/*
* resp.BufferOutput = false;
* resp.WriteFile(f.FullName);
* resp.Flush();
* resp.End();
*/
resp.BufferOutput = true;
resp.WriteFile(f.FullName);
//resp.End();
return(true);
}