Click here to Skip to main content
15,891,704 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Download A excel from Local Path in MVC2
when Clicking on link Text it will open .
can you please suggest any link..
i try like below but not working


C#
string Path = @"~\Content\templates\SAT Door Width 062012.xls";
            string contentType = "application/ms-excel";
            HttpContext.Response.Buffer = true;
            HttpContext.Response.Clear();
           HttpContext.Response.AddHeader("content-disposition",                         "attachment; filename=" + fileName);
            HttpContext.Response.ContentType = contentType;
            HttpContext.Response.WriteFile(HttpContext.Server.MapPath(Path));
Posted
Updated 20-Jan-13 19:24pm
v3
Comments
Richard C Bishop 18-Jan-13 11:24am    
This is not a question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900