Chilkat VB.NET HttpRequest Class Reference
HttpRequest
Represents a complete HTTP request.
Properties
Charset As String
Controls the character encoding used for HTTP request parameters for POST requests. The default value is "utf-8". The charset should match the charset expected by the form target.
HttpVersion As String
The HTTP version in the request header. Defaults to "1.1".
LastErrorHtml As String (ReadOnly)
Error information in HTML format for the last method called.
LastErrorText As String (ReadOnly)
Error information in plain-text format for the last method called.
LastErrorXml As String (ReadOnly)
Error information in XML format for the last method called.
NumHeaderFields As Integer (ReadOnly)
Returns the number of request header fields.
NumParams As Integer (ReadOnly)
Returns the number of query parameters.
Path As String
The path of the resource requested. A path of "/" indicates the default document for a domain.
SendCharset As Boolean
Controls whether the charset is explicitly included in the content-type header field of the HTTP POST request.
Methods
Function AddFileForUpload(ByVal name As String, ByVal filename As String) As Boolean
Adds a file to an upload request. To create a file upload request, call UseUpload and then call AddFileForUpload for each file to be uploaded.
Sub AddHeader(ByVal name As String, ByVal value As String)
Adds a request header to the HTTP request. If a header having the same field name is already present, this method replaces it.
Sub AddParam(ByVal name As String, ByVal value As String)
Adds a request query parameter (name/value pair) to the HTTP request. The name and value strings passed to this method should not be URL encoded.
Function AddStringForUpload(ByVal name As String, ByVal filename As String, ByVal strData As String, ByVal charset As String) As Boolean
Same as AddFileForUpload, but the upload data comes from an in-memory string instead of a file.
Function GenerateRequestText() As String
Returns the request text that would be sent if Http.SynchronousRequest was called. Returns Nothing on failure
Function GetHeaderField(ByVal name As String) As String
Returns the value of a request header field. Returns Nothing on failure
Function GetHeaderName(ByVal index As Integer) As String
Returns the Nth request header field name. Indexing begins at 0, and the number of request header fields is specified by the NumHeaderFields property. Returns Nothing on failure
Function GetHeaderValue(ByVal index As Integer) As String
Returns the Nth request header field value. Indexing begins at 0, and the number of request header fields is specified by the NumHeaderFields property. Returns Nothing on failure
Function GetParam(ByVal name As String) As String
Returns a request query parameter value by name. Returns Nothing on failure
Function GetParamName(ByVal index As Integer) As String
Returns the Nth request query parameter field name. Indexing begins at 0, and the number of request query parameter fields is specified by the NumParams property. Returns Nothing on failure
Function GetParamValue(ByVal index As Integer) As String
Returns the Nth request query parameter field value. Indexing begins at 0, and the number of request query parameter fields is specified by the NumParams property. Returns Nothing on failure
Function LoadBodyFromBytes(ByVal binaryData As Byte()) As Boolean
To be documented soon...
Function LoadBodyFromFile(ByVal filename As String) As Boolean
To be documented soon...
Function LoadBodyFromString(ByVal bodyStr As String) As Boolean
To be documented soon...
Sub RemoveAllParams()
Removes all request parameters.
Sub RemoveParam(ByVal name As String)
Removes a single HTTP request parameter by name.
Function SaveLastError(ByVal filename As String) As Boolean
Saves the last error information to an XML formatted file.
Sub SetFromUrl(ByVal url As String)
Parses a URL and sets the Path and query parameters (NumParams, GetParam, GetParamName, GetParamValue).
Sub UseGet()
Makes the HttpRequest a GET request.
Sub UseHead()
Makes the HttpRequest a HEAD request.
Sub UsePost()
Makes the HttpRequest a POST request that uses the "application/x-www-form-urlencoded" content type.
Sub UseUpload()
Makes the HttpRequest a POST request that uses the "multipart/form-data" content type. To create a file upload request, call UseUpload and then call AddFileForUpload for each file to be uploaded.
Sub UseXmlHttp(ByVal xmlBody As String)
Makes the HttpRequest a POST request using the "text/xml" content type. The request body is set to the XML string passed to this method.
|