Hi namojainashis...,
Refer below article. The exception is handled in the Catch block.
If any error comes you can log the error in the catch block.
If you want to check for particular error then you have to check condition with StatusCode.
For different StatusCode refer below link.
FtpStatusCode Enum
Example
C#
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
if ((int)response.StatusCode == 200)
{
// Success.
}
else
{
// Failure.
}
response.Close();
VB.Net
Dim response As FtpWebResponse = DirectCast(request.GetResponse(), FtpWebResponse)
If CInt(response.StatusCode) = 200 Then
' Success.
Else
' Failure.
End If
response.Close()