Context.Request Object

Description

The Context.Request object contains properties and methods available for working with the current HTTP request.

Properties

ApplicationRootCharacter

Context.Request.ApplicationRoot is the absolute physical path to the application on the server. Read Only.

ApplicationRootUrlCharacter

Context.Request.ApplicationRootUrl is the root url to the application. This is guaranteed to end with a forward slash ("/"). Read Only.

A5wIncludePathCharacter

Context.Request.A5wIncludePath is the absolute physical path to the location of the application's a5w files. Read Only.

A5wIncludePathCharacter

Context.Request.A5wIncludePath is the absolute physical path to the location of the application's a5w files. Read Only.

BodyBinary

The full body of the HTTP request. This is the raw data of the request body of a POST or PUT. If the request body is text, use Context.Request.GetBodyAsText() method to get the raw data property decoded to text. This will be empty for a GET request, as a GET does not include a body. Read Only.

ContentLengthNumeric

Context.Request.ContentLength is the length of the current request's content. Read Only.

ContentTypeCharacter

Context.Request.ContentType is the MIME type of the current request's content such as text/html or application/json. Read Write.

CookiesSystem::Web::HttpCookieCollection

Context.Request.Cookies is the collection of the current request's cookies. Read Only

FormSystem::Collections::Specialized::NameValueCollection

Context.Request.Form is the collection of the current request's form variables. The collection will have 0 entries if the page making the request does not have any forms on it. Read Only.

HeadersSystem::Collections::Specialized::NameValueCollection

Context.Request.Headers is the collection of the current request's HTTP headers. Read Only.

HeadersAsTextCharacter

Context.Request.HeadersAsText is a CrLf() delimited list of the request's HTTP headers. Read Only.

HostCharacter

Context.Request.Host is the value of the HTTP Host header. Read Only.

HttpMethodCharacter

Context.Request.HttpMethod is the current request's HTTP method such as GET, POST, or HEAD. Read Only.

IsLocalLogical

Context.Request.IsLocal indicates whether the current request was made on the same machine as the server. For instance, the request made by a browser was "http://localhost/index.a5w". This can be useful to add what may be sensitive diagnostic/debug information to a response knowing that it will only be added when the request was made on the same machine as the server. Read Only.

IsWorkingPreviewLogical

Context.Request.IsWorkingPreview will be .T. if the request is being processed in working preview. Otherwise, it is .F. Read Only.

ParamsSystem::Collections::Specialized::NameValueCollection

Context.Request.Params is a single collection that includes all the items in the following collections in this order: QueryString, Form, Cookies, and ServerVariables. Read Only.

PhysicalPathCharacter

Context.Request.PhysicalPath is the physical path to the file being requested. Read Only.

QueryStringSystem::Collections::Specialized::NameValueCollection

Context.Request.QueryString is a collection of the current request's query string's parsed name/value pairs. To get an unparsed query string use the ToString() method: Context.Request.QueryString.ToString(). To get the "firstName" query string value from this request, "http://www.acme.com/search/?firstName=John&lastName=Doe" use the following Xbasic: Context.Request.QueryString.Get("firstName")

Read Only.

QueryStringAsTextCharacter

Context.Request.QueryStringAsText is the URL decoded query part of the request url. For example: CompanyName=Alpha Software&City=Burlington&State=MA

RawUrlCharacter

Context.Request.RawUrl is the current request's URL with the protocol and domain prefix removed. The RawUrl for a request made with this URL "http://www.acme.com/search/?firstName=John&lastName=Doe" would be "/search/?firstName=John&lastName=Doe". Read Only.

RefererCharacter

Context.Request.Referer is the value of the HTTP Referer header. Read Only.

Remote_AddrCharacter

Context.Request.Remote_Addr is an alias of UserHostAddress and is provided for compatibility with Alpha Anywhere web applications that were written to run on the stand-alone server. Read Only.

Request_UriCharacter

Context.Request.Request_Uri is an alias of RawUrl and is provided for compatibility with Alpha Anywhere web applications that were written to run on the stand-alone server. Read Only.

ScriptNameCharacter

Context.Request.ScriptName is an alias for the current request's PATH_INFO server variable. Read Only.

Script_NameCharacter

Context.Request.Script_Name is an alias for ScriptName. Read Only.

ServerVariablesSystem::Collections::Specialized::NameValueCollection

Context.Request.ServerVariables is a collection of the web server variables. The follow is a list of variables that are supported on both IIS and the stand-alone application server. When running under IIS there may be other server variables available. See the Microsoft documentation for more details.

ALL_HTTP
ALL_RAW
APPL_MD_PATH
APPL_PHYSICAL_PATH
AUTH_PASSWORD
AUTH_TYPE
AUTH_USER
CERT_COOKIE
CERT_FLAGS
CERT_ISSUER
CERT_KEYSIZE
CERT_SECRETKEYSIZE
CERT_SERIALNUMBER
CERT_SERVER_ISSUER
CERT_SERVER_SUBJECT
CONTENT_LENGTH
CONTENT_TYPE
GATEWAY_INTERFACE
HEADER_

HeaderName interpreted as-is. For example, if you specify HEADER_MY-HEADER, the server searches for a request header named MY-HEADER.

HTTP_

HeaderName with underscores interpreted as dashes. For example, if you specify HTTP_MY_HEADER, the server searches for a request header named MY-HEADER.

HTTP_ACCEPT
HTTP_ACCEPT_ENCODING
HTTP_ACCEPT_LANGUAGE
HTTP_CONNECTION
HTTP_COOKIE
HTTP_HOST
HTTP_METHOD
HTTP_REFERER
HTTP_URL
HTTP_USER_AGENT
HTTP_VERSION
HTTPS
HTTPS_KEYSIZE
HTTPS_SECRETKEYSIZE
HTTPS_SERVER_ISSUER
HTTPS_SERVER_SUBJECT
LOGON_USER
PATH_INFO
QUERY_STRING
REMOTE_ADDR
REMOTE_HOST
REMOTE_USER
REQUEST_METHOD
SCRIPT_NAME
SCRIPT_TRANSLATED
SERVER_NAME
SERVER_PORT
SERVER_PORT_SECURE
SERVER_PROTOCOL
SERVER_SOFTWARE
UNENCODED_URL
URL

The following code is an example of how to retrieve a server variable:

Context.Request.ServerVariables.Get("HTTP_REFERER")
TemporaryDirectoryCharacter

Context.Request.TemporaryDirectory is the path to a temporary directory that is a unique for the request and is valid for the duration of a request. When the request is finished the directory is deleted. The directory path will always end with a back-slash ("\"). Read Only.

TimeoutBehaviorA5INETServerIntegration::RequestTimeoutBehavior

Context.Request.TimeoutBehavior is the setting for how a request timeout is determined. This setting allows a specific request to timeout differently than the system defined (default) timeout behavior. Use this setting if a request needs continue processing beyond a cancelled or dropped network connection or if the request process could take longer than 2 minutes. Typically requests should be processed as quickly as possible so that web server threads can be used to process other requests. Long running processing or processing that needs to be deterministic and have recoverability (restart if a resource like network, disk, or database is unavailable during processing) should be done through a workflow or other task processing subsystem.

This setting is active only for the current request from the point the value is set until the value is reset or the request ends.The value may be a combination of the following values:

Default

The Default option uses the system defined behavior which is to cancel request processing if the connection to the client is closed and to terminate a request after 2 minutes of processing.

ClientNoLongerConnected

The ClientNoLongerConnected option tracks whether the connection to the client is closed and if it is closed the request processing is terminated.

Duration

The Duration option tracks the duration of the request process. Once the duration defined by TimeoutDurationSeconds is exceeded the request processing is terminated. Use this option without the ClientNoLongerConnected option to let request processing continue even if the connection to the client is closed.

The following code is an example of how to set a request to terminate only after a 5 minute duration:

Context.Request.TimeoutBehavior = A5AS::A5INETServerIntegration::RequestTimeoutBehavior::Duration
Context.Request.TimeoutDurationSeconds = 300

The following code is an example of how to set a request to terminate after a 3 minute duration or a closed client connection:

Context.Request.TimeoutBehavior = A5AS::A5INETServerIntegration::RequestTimeoutBehavior::Duration .or. A5AS::A5INETServerIntegration::RequestTimeoutBehavior::ClientNoLongerConnected
Context.Request.TimeoutDurationSeconds = 180
TimeoutDurationSecondsNumeric

Context.Request.TimeoutDurationSeconds is the amount of time in seconds that a request is allowed to run before it is terminated. This is used in conjunction when Context.Request.TimeoutBehavior includes the A5AS::A5INETServerIntegration::RequestTimeoutBehavior::Duration option.

UserAgentCharacter

Context.Request.UserAgent is the UserAgent string that is sent by the browser. Read Only.

UserHostAddressCharacter

Context.Request.UserHostAddress is the IP host address of the remote client. Read Only.

VariablesPointer

Variables passed to the request. Includes state variables. Note: this variable is read only and cannot be used to set state information. Read Only.

'' Get value of state variable "myvar1"
if (variable_exists("context.request.variables._state.myvar1")) then
    dim myvar1 as c = context.request.variables._state.myvar1
end if

Methods

GetBodyAsText Method

Returns the request body decoded into text.

GetCookie Method

Returns a cookie if the cookie exists.

GetHeader Method

Get a header value as a string.

GetRequestTempFileName Method

Creates temporary file with a specified extension.

HasCookie Method

Tests if a cookie exists.