System.Net.FtpWebRequest.Abort C# (CSharp) Метод

Abort() публичный Метод

public Abort ( ) : void
Результат void
        public override void Abort() { throw null; }
        public override System.IAsyncResult BeginGetRequestStream(System.AsyncCallback callback, object state) { throw null; }

Usage Example

Пример #1
0
        public static bool UploadFile(string _sourcefile, string _targetfile, string _user, string _pass)
        {
            bool up = false;

            try
            {
                System.Net.FtpWebRequest ftp = (System.Net.FtpWebRequest)System.Net.FtpWebRequest.Create(_targetfile);
                ftp.Credentials = new System.Net.NetworkCredential(_user, _pass);
                //userid and password for the ftp server to given

                ftp.UseBinary  = true;
                ftp.UsePassive = true;
                ftp.EnableSsl  = Core.Global.GetConfig().ConfigFTPSSL;
                ftp.Method     = System.Net.WebRequestMethods.Ftp.UploadFile;
                System.IO.FileStream fs = System.IO.File.OpenRead(_sourcefile);
                byte[] buffer           = new byte[fs.Length];
                fs.Read(buffer, 0, buffer.Length);
                fs.Close();
                System.IO.Stream ftpstream = ftp.GetRequestStream();
                ftpstream.Write(buffer, 0, buffer.Length);
                ftpstream.Close();
                ftp.Abort();
                up = true;
            }
            catch (Exception ex)
            {
                Core.Log.WriteLog(ex.ToString(), true);
            }
            return(up);
        }
All Usage Examples Of System.Net.FtpWebRequest::Abort