Export (0) Print
Expand All

Verb Property

Visual Studio .NET 2003

Gets or sets the HTTP method verb for the request.

strVerb = Request.Verb [= strVerb]

Return value

strVerb As String: The HTTP verb for the request. The default value for Request objects is "GET".

Remarks

The object model does not restrict Verb property values, so standard HTTP 1.1 methods, World Wide Web Distributed Authoring and Versioning (WEBDAV) extensions, and even invalid HTTP methods can be assigned to the Request object's Verb property. They are sent, unchanged, in the request-line of the message.

HTTP 1.1 method names are case-sensitive. The valid methods are: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, and CONNECT. A Web server will return a status code value of 405 (not allowed) or 501 (not implemented) if it does not support the method in the request (see the Response.ResultCode property).

The method value determines how the Web server responds to the request. For example, the HEAD method causes the Web server to return only the header information for the resource specified by the request, while the GET method causes the server to return a header and a message body.

Examples

 
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Function to get a resource's size by sending a HEAD 
' request to the server and checking the value of the 
' Content-Length header field.
'
Function GetResourceSize(strServer, strPath)   
   Dim oConnection, oRequest, oResponse, oContentLengthHeader
   Dim strContentLength

   Set oConnection = Test.CreateConnection(strServer)
   ' check for connection errors
   If (oConnection Is Nothing) Then
      Test.Trace("Error: Unable to create connection.")
   Else
      Set oRequest = Test.CreateRequest
      oRequest.Path = strPath
      oRequest.Verb = "HEAD"
      Set oResponse = oConnection.Send(oRequest)
      If (oRequest Is Nothing) Then
         Call Test.Trace("Error: invalid request or host not found ")
      Else
         If (oResponse.ResultCode = "200") Then
            Set oContentLengthHeader = oResponse.Headers.Item("Content-Length")
            strContentLength = "Content-Length=" & oContentLengthHeader.Value
         Else
            strContentLength = "Error, status code: " & oResponse.ResultCode
         End If
      End If
      Call oConnection.Close()
   End If

   GetResourceSize = strContentLength
End Function
 

See Also

Request object| Request.Path | Request.HTTPVersion | Response.ResultCode property

Show:
© 2014 Microsoft