I have document library with name "magazines". containing several pdfs, I'm using caml to view these items on one page pdfs. Added 2 links on this page to the user view pdf online, and to download. Para forçar o download, eu estou redirecionando o usuário para uma nova página: http://site.com/download.aspx?urlLibrary=http://site.com/magazines/&fileName=1.pdf
This page is the following code:
Response.Clear(); Response.AddHeader("content-disposition", "attachment; filename=" + Request.QueryString["fileName"]); Response.ContentType = "application/pdf"; Response.WriteFile(Server.MapPath("~/" + Request.QueryString["urlLibrary"] + Request.QueryString["fileName"])); Response.End();
The download occurs at the user side, so that when you open the pdf of error, and the file has little kybtes over the original pdf. How can I force a download of the document library?