PowerTCP Mail for .NET
ToString Method
See Also  Example Send comments on this topic.
Dart.PowerTCP.Mail Namespace > Response Class : ToString Method




Returns the complete response string received.

Syntax

Visual Basic (Declaration) 
Public Overrides Function ToString() As String
Visual Basic (Usage)Copy Code
Dim instance As Response
Dim value As String
 
value = instance.ToString()
C# 
public override string ToString()
Managed Extensions for C++ 
public: string* ToString(); override 
C++/CLI 
public:
String^ ToString(); override 

Return Value

A string representing the unparsed response from the server.

Example

The following example demonstrates the ConnectedChanged event, and how using the AutoClose property effects the connection status.
Visual BasicCopy Code
' Set server and user properties. This will allow calling of other
' Ftp Component methods with the log in taking place "behind the scenes"
Ftp1.Server = "MyFTPServer"
Ftp1.Username = "blah"
Ftp1.Password = "mypass"


' Create Invoke object
Dim f As Dart.PowerTCP.Ftp.Invoke

' Call a couple of methods. The ConnectedChange event should only fire once , to connect
Debug.WriteLine("Sending a PWD command. The ConnectedChanged Event should fire once for this (log in)")
f = Ftp1.Invoke(Dart.PowerTCP.Ftp.FtpCommand.PrintDir)
Debug.WriteLine("Response from server: " + f.Response.ToString())

' Because the connection is maintained, the ConnectedChanged event will not fire for other methods called
Debug.WriteLine("Sending a HELP command. The ConnectedChanged Event should not fire for this.")
f = Ftp1.Invoke(Dart.PowerTCP.Ftp.FtpCommand.Help)
Debug.WriteLine("Response from server: " + f.Response.ToString())

' Be sure to close the connection. The ConnectedChanged event should fire once more
Ftp1.Close()

' Monitor the connection status using the ConnectedChanged event
Private Sub Ftp1_ConnectedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Ftp1.ConnectedChanged

   ' The state of the connection has changed. Check current state.
   If Ftp1.Connected Then
      Debug.WriteLine("FTP Control connection connected")
   Else
      Debug.WriteLine("FTP Control connection disconnected")
   End If
End Sub
C#Copy Code
// Set server and user properties. This will allow calling of other
// Ftp Component methods with the log in taking place "behind the scenes"
ftp1.Server = "MyFTPServer";
ftp1.Username = "blah";
ftp1.Password = "mypass";

// Create Invoke object

Dart.PowerTCP.Ftp.Invoke f;

// Call a couple of methods. The ConnectedChange event should only fire once , to connect
Debug.WriteLine("Sending a PWD command. The ConnectedChanged Event should fire once for this (log in)");
f = ftp1.Invoke(Dart.PowerTCP.Ftp.FtpCommand.PrintDir);
Debug.WriteLine("Response from server: " + f.Response.ToString());

// Because the connection is maintained, the ConnectedChanged event will not fire for other methods called
Debug.WriteLine("Sending a HELP command. The ConnectedChanged Event should not fire for this.");
f = ftp1.Invoke(Dart.PowerTCP.Ftp.FtpCommand.Help);
Debug.WriteLine("Response from server: " + f.Response.ToString());

// Be sure to close the connection. The ConnectedChanged event should fire once more
ftp1.Close();


// Monitor the connection status using the ConnectedChanged event.

private void ftp1_ConnectedChanged(object sender, System.EventArgs e)
{

    // The state of the connection has changed. Check current state.
    if(ftp1.Connected)
        Debug.WriteLine("FTP control connection connected.");
    else
        Debug.WriteLine("FTP control connection disconnected.");
}

Remarks

The String.ToString method is overridden to allow access to the entire unparsed string. To retrieve a parsed listing of the response code or text, use the Response.Code or Response.Text property, respectively.

This property is useful if you wish to see the entire response string returned from the server without any formatting applied.

Requirements

Target Platforms: Microsoft .NET Framework 2.0

See Also

Documentation Version 3.2
© 2010 Dart Communications. All Rights Reserved.