I wanted to have a link when user clicked, it allow user to download document from SharePoint Document Library.
The link will be placed inside an aspx page.
I tried the function below:
Response.ContentType = "application/xls";
Response.AppendHeader("Content-Disposition", "attachment; filename=abc.xls");
Response.TransmitFile(Server.MapPath("~/abc.xls"));
Response.End();
It allow me to download the document successfully, but the downloaded document cannot open.
what is the better way to do this?
Appreciate if you could provide me some references, thank you.