The GetText method is used to download a text file or
retrieve the text output from a script and store the contents in a
string buffer. Because binary data can include embedded null
characters which would truncate the string, this method should only be
used with text files or script output which is known to be textual.
For example, it is safe to use this method when the server returns
HTML or XML data, but should not be used if it returns an image or
executable file. Always use the GetData method if you wish to
retrieve binary data and store it in a byte array.
The text returned by the server is automatically converted to
Unicode using the code page specified by the CodePage property.
Text returned by a web server will typically use UTF-8 encoding,
however some servers may return text content using their own locale.
If you specify an incorrect code page, this can
result in a conversion error.
This method will always attempt to normalize the end-of-line character
sequence to use a carriage-return and linefeed (CRLF) pair. This can
potentially result in a discrepancy between the size of a text file on
the server and the actual length of the string buffer.
This method will attempt to indicate to the server that only
textual data is acceptable, however some servers may ignore this
constraint. If the server does return binary data in response to the
request, the string buffer may be empty or contain unprintable
characters as the result of attempting to convert the data to Unicode.
This method will cause the current thread to block until the file
transfer completes, a timeout occurs or the transfer is canceled.
During the transfer, the OnProgress event will fire
periodically, enabling the application to update any user interface
objects such as a progress bar.