// for creating ftp connection FtpWebRequest request = (FtpWebRequest)FtpWebRequest.Create(ConfigurationManager.AppSettings["ftppath"].ToString() + filename); // to tell that going to upload file request.Method = WebRequestMethods.Ftp.UploadFile; // settng the network credentials request.Credentials = new NetworkCredential("" + ConfigurationManager.AppSettings["ftpuser"].ToString() + "", "" + ConfigurationManager.AppSettings["ftppass"].ToString() + ""); // setting passive mode request.UsePassive = true; request.UseBinary = true; request.KeepAlive = false; //request.EnableSsl = true; // reading file from server which is going to upload FileStream stream = File.OpenRead(Server.MapPath(csvpath + filename)); byte[] buffer = new byte[stream.Length]; stream.Read(buffer, 0, buffer.Length); stream.Close(); // this line is giving me error since the connection is changed by the NAT firewall due to this I am // getting error // thi line is for uploading the file Stream reqStream = request.GetRequestStream(); reqStream.Write(buffer, 0, buffer.Length); reqStream.Close();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)