I want to open excel in asp.net web browser.
Help needed. When i click on button it opens the excel.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Abhay ShankerPosted May 19, 2014, 2:57 AM
System.IO.FileInfo fleInfo = new System.IO.FileInfo("c:\\abcd.xls");
Response.Clear();
Response.Charset = "Shift_JIS";
Response.AddHeader("Content-Disposition", "attachment; filename='test.xls'");
Response.AddHeader("Content-Length", fleInfo.Length.ToString());
Response.ContentType = "application/vnd.ms-excel";
Response.WriteFile(fleInfo.FullName);
Response.End();