ftp client c# code issue

Apr 2, 2012 at 1:17 PM

I could not create the ftp client code to upload the file. Here is the code:

 

FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://????.cloudapp.net/svouser2/mytest.txt" );

request.Proxy =null

;

request.Method =WebRequestMethods.Ftp

.UploadFile;

request.UsePassive =false;  

request.Credentials =

new NetworkCredential("user", "pass"

);

 StreamReader sourceStream = new StreamReader("C:\\?????\\mytest.txt" 

);

 byte[] fileContents = Encoding 

.UTF8.GetBytes(sourceStream.ReadToEnd());

requestStream = request.GetRequestStream();

)request.GetResponse();

response.Close();

requestStream.Write(fileContents, 0, fileContents.Length);

requestStream.Close();

FtpWebResponse response = (FtpWebResponse

sourceStream.Close();

request.ContentLength = fileContents.Length;

 Stream

 

What is wrong?