public FtpWebRequest CreateRequest(string url, string method) { NetUri netUri = NetUri.Create(url); if (!netUri.IsValidProtocol) { throw new Exception("Invalid protocol."); } FtpWebRequest ftpWebRequest = FtpWebRequest.Create(url) as FtpWebRequest; ftpWebRequest.UseBinary = true; ftpWebRequest.Method = method; ftpWebRequest.Credentials = networkCredential; if (webProxy != null) { ftpWebRequest.Proxy = webProxy; } return(ftpWebRequest); }