Post text data to the server specifying one or more options and returns the response in a string.
This method returns a boolean value. If the method succeeds, the return value is true. If the method fails, the return value is false. To get extended error information, check the value of the LastError property.
The PostText method is used to submit text data to a REST endpoint or script which executes on the server. The server response is returned in a string passed by reference to the method. This method automatically sets the content type and encoding required for submitting plain text data to the server. If the text contains any Unicode characters, it will automatically be converted to UTF-8 prior to being submitted.
The content type specified with the request is normally text/plain, which is a generic type appropriate for most text. You can override this by setting the ContentType property prior to calling this method.
If the server rejects the request for any reason, this method will return false indicating the operation has failed. If you want the responseData string to include any error response from the server, specify HttpPostOptions.ErrorData as one of the options. In this case, the method will return true even if the server rejects the request and the responseData string will contain the error response. You can use the value of the ResultCode property to determine if the server accepted or rejected the request.
This method will cause the current thread to block until the operation completes, a timeout occurs or the post is canceled. During the operation, the OnProgress event will fire periodically, enabling the application to update any user interface objects, such as a progress bar, when submitting large requests to the server.