Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
when i click the row in datagrid of wpf,the selected row values send to ftp server with aprogressbar.Am new in WPF,So Please help me to solve my problem
Posted
Updated 29-May-14 0:30am
v2

1 solution

Hello,

You will find following Code Project articles very useful.

Sample code (Directly taken from MSDN)
C#
using System;
using System.IO;
using System.Net;
using System.Text;

namespace Net.FtpUtil
{
    public class FtpHelper
    {
        public void doUpload(String strData)
        {
            // Get the object used to communicate with the server.
            FtpWebRequest request = (FtpWebRequest) WebRequest.Create("ftp://www.myserver.com");
            request.Method = WebRequestMethods.Ftp.UploadFile;

            // This example assumes the FTP site uses anonymous logon.
            request.Credentials = new NetworkCredential ("anonymous","anonymous@contoso.com");
            
            // Copy the contents of the file to the request stream.
            byte [] fileContents = Encoding.UTF8.GetBytes(strData);
            request.ContentLength = fileContents.Length;

            Stream requestStream = request.GetRequestStream();
            requestStream.Write(fileContents, 0, fileContents.Length);
            requestStream.Close();

            FtpWebResponse response = (FtpWebResponse)request.GetResponse();
   
            response.Close();
        }
    }
}

Regards
 
Share this answer
 
Comments
Member 10830802 29-May-14 6:08am    
thanks Bhai,but how to send a datagrid row values to ftp

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900