Tks Shrinivas Mada and All. you helped me!
2010/5/5 ѕняєє мα∂α <[email protected]> > hello , > try following code , > > Response.ContentType = "application/pdf"; > > System.IO.FileStream sourceFile = new > System.IO.FileStream(Server.MapPath("") + "/ReferralReport.pdf", > System.IO.FileMode.Open); > long FileSize; > FileSize = sourceFile.Length; > byte[] getContent = new byte[(int)FileSize]; > sourceFile.Read(getContent, 0, (int)sourceFile.Length); > sourceFile.Close(); > Response.Clear(); > string fname = "ReferralReport.pdf"; > Response.AddHeader("Content-Disposition", "attachment;filename=" > + fname); > > Response.AddHeader("Content-Length", > getContent.Length.ToString()); > Response.ContentType = "application/octet-stream"; > Response.BinaryWrite(getContent); > > Thanks & Regards, > Shrinivas Mada, > cell : 9975638418 > > > > > On Tue, May 4, 2010 at 6:18 PM, Alex Vidotto <[email protected]>wrote: > >> Hi, I found the problem. The code works, the problem is in the >> UpdatePanel, the link must be outside the UpdatePanel to work, another >> problem is that I work with UpdatePanel in masterpage, that is my >> contentspages are inside the UpdatePanel, does anyone have a solution that >> can work within the UpdatePanel? >> Regards >> >> 2010/5/4 Peter Groenewegen <[email protected]> >> >> Have you put a breakpoint in the method to verify that the code runs? >>> >>> On Mon, May 3, 2010 at 11:23 PM, Alex Vidotto <[email protected]> >>> wrote: >>> > Alright guys? >>> > >>> > I have a problem .. >>> > I want to provide a link to download the file on the site. >>> > Look at the method: >>> > >>> > private void startDownload(string URL) >>> > { >>> > >>> > string path = MapPath(URL); >>> > string name = Path.GetFileName(path); >>> > string ext = Path.GetExtension(path); >>> > >>> > Response.ContentType = "Application/pdf"; >>> > Response.AppendHeader("content-disposition", >>> > "attachment; filename=" + name); >>> > Response.WriteFile(path); >>> > Response.End(); >>> > >>> > } >>> > >>> > >>> > The download does not start, can someone help me? >>> > >>> > tks >>> > Alex Vidotto >>> > >>> > >>> >> >> >> >> -- >> Att. >> Alex Vidotto >> >> > -- Att. Alex Vidotto
