Geeks With Blogs
Fórmulas e Cenas Object Reference Not Set to an Instance of an Object October 2010 Entries
How to: Upload a file using FTP
FileInfo fileInf = new FileInfo("c:\myfile.txt"); FtpWebRequest reqFTP = (FtpWebRequest)FtpWebReques... Uri("ftp://myFTPSite/myfile... reqFTP.Credentials = new NetworkCredential("myUser",... "myFTPDomain"); reqFTP.KeepAlive = false; reqFTP.Method = WebRequestMethods.Ftp.Uploa... reqFTP.UseBinary = true; reqFTP.ContentLength = fileInf.Length; int buffLength = 2048; byte[] buff = new byte[buffLength]; int contentLen; FileStream fs = fileInf.OpenRead(); try { Stream strm = ......

Posted On Thursday, October 7, 2010 11:31 AM

How to: Download a file using FTP
FileStream outputStream = new FileStream("c:\myfilefolder... FtpWebRequest reqFTP = (FtpWebRequest)FtpWebReques... Uri("ftp://myFTPSite/file.t... reqFTP.Method = WebRequestMethods.Ftp.Downl... reqFTP.UseBinary = true; reqFTP.Credentials = new NetworkCredential("myUser",... FtpWebResponse response = (FtpWebResponse)reqFTP.GetR... Stream ftpStream = response.GetResponseStream(); int bufferSize = 2048; int readCount; byte[] buffer = new byte[bufferSize]; ......

Posted On Thursday, October 7, 2010 11:24 AM

How to: List Files from an FTP Location
FtpWebRequest reqFTP = (FtpWebRequest)FtpWebReques... Uri("ftp://myFTPURL/")); reqFTP.UseBinary = true; reqFTP.Credentials = new NetworkCredential("myUser", "myPassword", "FTPDomain"); reqFTP.Method = WebRequestMethods.Ftp.ListD... WebResponse response = reqFTP.GetResponse(); StreamReader reader = new StreamReader(response.GetRe... string line = reader.ReadLine(); while (line != null) { line = reader.ReadLine(); } reader.Close(); response.Close(); Enjoy :) ......

Posted On Thursday, October 7, 2010 11:17 AM

Copyright © Sglima | Powered by: GeeksWithBlogs.net | Join free