When i use this code click on asp.Button then all operation correct but file not download. Please help me
FtpWebRequest request1 = null; request1 = (FtpWebRequest)WebRequest.Create(ftpServerIP + Session["appid"] + "/" + fname); //Enter FTP Server credentials. request1.Credentials = new NetworkCredential(ftpUserID, ftpPassword); request1.UsePassive = true; request1.UseBinary = true; request1.EnableSsl = false; request1.Method = WebRequestMethods.Ftp.DownloadFile; //Fetch the Response and read it into a MemoryStream object. FtpWebResponse response1 = (FtpWebResponse)request1.GetResponse(); using (MemoryStream stream = new MemoryStream()) { //Download the File. response1.GetResponseStream().CopyTo(stream); Response.AddHeader("content-disposition", "attachment;filename=" + fname); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.BinaryWrite(stream.ToArray()); Response.End(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)