FileStream file = new FileStream(Server.MapPath(@"TemFiles\2.xls"), FileMode.Open, FileAccess.Read);
HSSFWorkbook workbook = new HSSFWorkbook(file);
ISheet sheet1 = workbook.GetSheetAt(0);
IRow row1 = sheet1.CreateRow(0);
row1.CreateCell(0).SetCellValue(1);
sheet1.CreateRow(0).CreateCell(0).SetCellValue("This is a Sample");
sheet1.GetRow(0).CreateCell(0).SetCellValue("This is a Sample");
MemoryStream msfile = new MemoryStream();
workbook.Write(msfile);
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.ContentType = "application/octet-stream";
var fileName = HttpUtility.UrlEncode("2");
Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName + ".xls");
Response.BinaryWrite(msfile.GetBuffer());