Skip to content

cHttpServerRequest Request Object ​

Overview ​

cHttpServerRequest encapsulates all information of an HTTP request, including request method, URL, headers, parameters, form data, JSON data, etc.

Properties ​

Method ​

Request method enum value.

vb
Public Method As EnumRequestMethod

Values:

  • ReqPost = 1
  • ReqGet = 2
  • ReqPut = 3
  • ReqDelete = 4
  • ReqOptions = 5

Example:

vb
If ctx.Request.Method = ReqPost Then
    Debug.Print "POST request"
End If

MethodName ​

Request method name string.

vb
Public MethodName As String

Example:

vb
Debug.Print "Method: " & ctx.Request.MethodName  ' Output: GET or POST etc.

HttpVersion ​

HTTP version.

vb
Public HttpVersion As String

Example:

vb
Debug.Print "HTTP Version: " & ctx.Request.HttpVersion  ' Output: HTTP/1.1

Url ​

Full request URL (decoded).

vb
Public Url As String

Example:

vb
Debug.Print "URL: " & ctx.Request.Url
' Output: /user/list?page=1&limit=10

PathInfo ​

Request path (without query parameters).

vb
Public PathInfo As String

Example:

vb
' Request /user/list?page=1
Debug.Print "Path: " & ctx.Request.PathInfo
' Output: /user/list

PathInfoList ​

Path segment collection (cCollection type). Each segment of the URL path split by / is stored in the collection, where both key and value are the segment name, supporting access by index and by key.

vb
Public PathInfoList As New cCollection

Example:

vb
' Request GET /api/user/list?page=1
ctx.Request.PathInfoList(1)          ' → "api"
ctx.Request.PathInfoList.Count       ' → 3
ctx.Request.PathInfoList.Exists("api") ' → True

👉 For full usage, see Parameter Routing & Path Segment Parsing


PathInfoController ​

Controller name from automatic route parsing.

vb
Public PathInfoController As String

Example:

vb
' Request /User/List
Debug.Print "Controller: " & ctx.Request.PathInfoController
' Output: User

PathInfoAction ​

Action method name from automatic route parsing.

vb
Public PathInfoAction As String

Example:

vb
' Request /User/List
Debug.Print "Action: " & ctx.Request.PathInfoAction
' Output: List

QueryInfo ​

Query string.

vb
Public QueryInfo As String

Example:

vb
' Request /user?page=1&limit=10
Debug.Print "Query: " & ctx.Request.QueryInfo
' Output: page=1&limit=10

QueryString ​

Query parameter dictionary.

vb
Public QueryString As New Dictionary

Example:

vb
' GET /user?id=123&name=John
Dim id As String
id = ctx.Request.QueryString("id")

Dim name As String
name = ctx.Request.QueryString("name")

RouteParams ​

Route parameter dictionary. When a parameter route (e.g., /api/user/{id}) matches successfully, the parameter values from the URL are stored in this dictionary.

vb
Public RouteParams As New Dictionary

Example:

vb
' Route: /api/user/{id}, Request: GET /api/user/123
Dim userId As String
userId = ctx.Request.RouteParams("id")    ' → "123"

' Check if parameter exists
If ctx.Request.RouteParams.Exists("id") Then ...

👉 For full usage, see Parameter Routing & Path Segment Parsing


Form ​

POST form data dictionary.

vb
Public Form As New Dictionary

Example:

vb
' POST form: username=admin&password=123
Dim username As String
username = ctx.Request.Form("username")

Dim password As String
password = ctx.Request.Form("password")

Json ​

JSON data object.

vb
Public Json As New cJson

Example:

vb
' POST JSON: {"name":"John","age":25}
Dim name As String
name = ctx.Request.Json.GetItem("name")

Dim age As Long
age = ctx.Request.Json.GetItem("age")

Request header dictionary.

vb
Public Header As New Dictionary

Example:

vb
' Get User-Agent
If ctx.Request.Header.Exists("User-Agent") Then
    Debug.Print ctx.Request.Header("User-Agent")
End If

' Get Authorization
Dim token As String
token = ctx.Request.Header("Authorization")

HeaderRaw ​

Raw request header string.

vb
Public HeaderRaw As String

HeaderUserAgent ​

User-Agent shortcut access.

vb
Public HeaderUserAgent As String

HeaderAccept ​

Accept header shortcut access.

vb
Public HeaderAccept As String

HeaderHost ​

Host header.

vb
Public HeaderHost As String

HeaderHostDomain ​

Domain part.

vb
Public HeaderHostDomain As String

HeaderHostPort ​

Port part.

vb
Public HeaderHostPort As Long

HeaderContentType ​

Content-Type header.

vb
Public HeaderContentType As String

HeaderContentLength ​

Content-Length header.

vb
Public HeaderContentLength As Long

RawBodyText ​

Raw request body text.

vb
Public Property Get RawBodyText() As String

RawBodyBin ​

Raw request body byte array.

vb
Public Property Get RawBodyBin() As Byte()

Item (Default Property) ​

Smart parameter value getter (searches QueryString, Form, Json in order).

vb
Public Property Get Item(ByVal key) As Variant

Example:

vb
' Auto-get parameter from query/form/json
Dim value As Variant
value = ctx.Request("username")
value = ctx.Request("page")

Last Updated: 2026-06-11

VB6 and LOGO copyright of Microsoft Corporation