FtpClient.SetHashAlgorithm Method

System.Net.FtpClient

Collapse image Expand Image Copy image CopyHover image
Tells the server which hash algorith to use for the HASH command. If you specifiy an algorithm not listed in FtpClient.HashTypes a NotImplemented() exectpion will be thrown so be sure to query that list of Flags before selecting a hash algorithm. Support for the HASH command is experimental. Please see the following link for more details: http://tools.ietf.org/html/draft-bryan-ftpext-hash-02

Namespace: System.Net.FtpClient
Assembly: System.Net.FtpClient (in System.Net.FtpClient.dll) Version: 1.0.5064.17461

Syntax

C#
public void SetHashAlgorithm(
	FtpHashAlgorithm type
)
Visual Basic
Public Sub SetHashAlgorithm ( 
	type As FtpHashAlgorithm
)
Visual C++
public:
virtual void SetHashAlgorithm(
	FtpHashAlgorithm type
) sealed

Parameters

type
Type: System.Net.FtpClient..::..FtpHashAlgorithm
Hash Algorithm

Implements

IFtpClient..::..SetHashAlgorithm(FtpHashAlgorithm)

Examples

C#  Copy imageCopy
using System;
using System.Net;
using System.Net.FtpClient;

namespace Examples {
    public class SetHashAlgorithmExample {
        public static void SetHashAlgorithm() {
            using (FtpClient cl = new FtpClient()) {
                cl.Credentials = new NetworkCredential("user", "pass");
                cl.Host = "some.ftpserver.on.the.internet.com";

                if (cl.HashAlgorithms.HasFlag(FtpHashAlgorithm.MD5))
                    cl.SetHashAlgorithm(FtpHashAlgorithm.MD5);
            }
        }
    }
}

See Also