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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Abhay ShankerRank #375 · 6.7K reputationPosted May 18, 2014, 10:57 PM EDT
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();