Request Object

Context.Request object."/>

Description

The Request Object is used with the Alpha Anywhere Classic Application Server. To access the Request object in the Alpha Anywhere Application Server for IIS, use the Context.Request object.

Discussion

A5W pages have access to a system object named Request. This object represents the parsed HTTP request that was received by the Application Server and has a number of properties available.

Prior to Version 10, the Request object was local to the page (script) and had to be passed to any functions that need access to it.

Properties

Request.A5WIncludePathCharacter

Indicates the path that will be used as the default location for the a5w_include function.

Request.AcceptCharacter
Request.Accept is deprecated. Use Request.GetHeader Method instead. E.g. Request.GetHeader("Accept")

The value of the Accept HTTP header, which indicates the MIME types that the client can accept. This property was optionally created in versions 6-9, but will always exist in version 10. If an Accept header was not included in the request, the value will be blank. Previously, this property would not exist if the header was not included, requiring additional Xbasic code to test for its existence first.

Request.AcceptCharsetCharacter
Request.AcceptCharset is deprecated. Use Request.GetHeader Method instead. E.g. Request.GetHeader("Accept-Charset")

The value of the Accept-Charset HTTP header, which indicates the character sets that the client can accept. If an Accept-Charset header was not included in the request, the value will be blank. Previously, this property would not exist if the header was not included, requiring additional Xbasic code to test for its existence first.

Request.AcceptEncodingCharacter
Request.AcceptEncoding is deprecated. Use Request.GetHeader Method instead. E.g. Request.GetHeader("Accept-Encoding")

The value of the Accept-Encoding HTTP header, which indicates the types of transfer encoding accepted by the client. This replaces the optional Accept_Encoding property in versions 6-9. If an Accept-Encoding header was not included in the request, the value will be blank. Previously, this property would not exist if the header was not included, requiring additional Xbasic code to test for its existence first.

Request.AcceptLanguageCharacter
Request.AcceptLanguage is deprecated. Use Request.GetHeader Method instead. E.g. Request.GetHeader("Accept-Language")

The value of the Accept-Language HTTP header, which indicate the languages that the client is configured to accept. This replaces the optional Accept_Language property in versions 6-9. If an Accept-Language header was not included in the request, the value will be blank. Previously, this property would not exist if the header was not included, requiring additional Xbasic code to test for its existence first.

Request.ApplicationRootCharacter

The path to the root of the current application, as seen from the server. For example, if you publish an application to c:\a5webroot\app1 on your server, Request.ApplicationRoot will contain the value c:\a5webroot\app1 for all requests for anything in that application, even if it is in a subfolder. So http://server/app1/page1.a5w would see the same value as http://server/app1/subfolder1/page2.a5w.

Request.BodyCharacter

The full body of the HTTP request. This will be empty for a GET request, as a GET does not include a body.

Request.Browser.CookiesEnabledLogical

A logical value that indicates whether or not the client browser accepts cookies.

Request.ConnectionCharacter

The value of the Connection HTTP header, which contains the connection type requested by the client, such as "Keep-Alive". This property was optionally created in versions 6-8, but will always exist in version 9.

Request.ContentTypeCharacter

A string that describes any encoding applied by the client before sending the request. It is typically blank, but some HTML forms may use a type of "multipart/form-data".

Request.CookieCharacter
Request.Cookie is deprecated. Use Request.GetHeader Method instead. E.g. Request.GetHeader("Cookie")

The value of the Cookie HTTP header, which is a string containing all cookies sent by the client. This property was optionally created in versions 6-9, but will always exist in version 10. If a Cookie header was not included in the request, the value will be blank. Previously, this property would not exist if the header was not included, requiring additional Xbasic code to test for its existence first.

Request.CookiesPointer

An object containing all of the variables created from the cookie(s) included in the HTTP request sent from the client.

Request.Cookies will be changing to be a System::Web::HttpCookieCollection in the future. Currently it is an Xbasic property class ("dot variable"). Once changed, any Xbasic code expecting a property class will fail. To prepare for the upcoming change, the new Request.HasCookie method and Request.GetCookie method can be used to replace code that directly operates on Request.Cookies. These methods will continue to work even after the underlying type of Request.Cookies is changed. These methods also work consistently in both the Classic Application Server and the Application Server for IIS.
Request.HeadersCharacter

The headers of the request in a CR or CR-LF delimited list.

Request.Headers will be changing to a System::Collections::Specialized::NameValueCollection. Currently it is a character string containing the raw header text of the HTTP request. To prepare for the upcoming change, the new Request.GetHeader method can be used to replace code that directly operates on Request.Headers. This method will continue to work even after the underlying type of Request.Headers is changed. The Request.GetHeader() method also works consistently in both the Classic Application Server and the Application Server for IIS.
Request.HTTP_RequestCharacter
Request.HTTP_Request is deprecated. No replacement for this property exists.

The first line of the request headers, which tells the server what file to retrieve and how to retrieve it.

Request.HttpMethodCharacter

A read-only character property indicating the HTTP method used when the request was made.

Request.HostCharacter

The hostname and port that this request was sent to. Request.Host will always exist if the client uses HTTP/1.1, but it may not if the client uses HTTP/1.0.

Example

<%a5
?Context.Request.Host
'This will output www.acme.com for a request url of https://www.acme.com/index.a5w?category=tools&subcategory=handtools
'This will output www.acme.com:446 for a request url of https://www.acme.com:446/index.a5w?category=tools&subcategory=handtools
%>
Request.HostNameCharacter

The hostname that this request was sent to. Request.HostName will always exist if the client uses HTTP/1.1, but it may not if the client uses HTTP/1.0.

Example

<%a5
?Context.Request.HostName
'This will output www.acme.com for a request url of https://www.acme.com/index.a5w?category=tools&subcategory=handtools
'This will have the same output www.acme.com as above for a request url of https://www.acme.com:446/index.a5w?category=tools&subcategory=handtools
%>
Request.IfModifiedSinceCharacter
Request.IfModifiedSince is deprecated. Use Request.GetHeader Method instead. E.g. Request.GetHeader("If-Modified-Since")

The value of the If-Modified-Since HTTP header, which a client may include to ask the server to compare a client cached version of the resource with the resource on the server.

Request.IfUnmodifiedSinceCharacter
Request.IfUnmodifiedSince is deprecated. Use Request.GetHeader Method instead. E.g. Request.GetHeader("If-Unmodified-Since")

The value of the If-Unmodified-Since HTTP header, which a client may include to ask the server to compare a client cached version of the resource with the resource on the server.

Request.OriginCharacter

Returns the protocol, hostname, and port number of the request URL.

Example

<%a5
?Context.Request.Origin
'This will output https://www.acme.com for a request url of https://www.acme.com/index.a5w?category=tools&subcategory=handtools
'This will output https://www.acme.com:446 for a request url of https://www.acme.com:446/index.a5w?category=tools&subcategory=handtools
%>
Request.PathNameCharacter

Returns the path of the request URL.

Example

<%a5
?Context.Request.PathName
'This will output /index.a5w for a request url of https://www.acme.com/index.a5w?category=tools&subcategory=handtools
%>
Request.PortCharacter

Returns the port number of the request URL.

Example

<%a5
?Context.Request.Port
'This will output 443 for a request url of https://www.acme.com/index.a5w?category=tools&subcategory=handtools
'This will output 446 for a request url of https://www.acme.com:446/index.a5w?category=tools&subcategory=handtools
%>
Request.ProtocolCharacter

Returns the protocol request URL.

Example

<%a5
?Context.Request.Protocol
'This will output https for a request url of https://www.acme.com/index.a5w?category=tools&subcategory=handtools
%>
Request.Query_StringCharacter
Request.Query_String is deprecated in Alpha Anywhere. Use Context.Request.queryString.toString() instead.

The query string of a GET request, such as "foo=bar&this=that".

Request.RawCharacter

The complete raw request received by the server.

Request.RefererCharacter

Contains the URL of the page from which the user came.

Request.Referer is extremely unreliable for any type of run-time decision making. It is really only useful for statistical analysis of your logs, for example to determine whether your traffic came from a search engine or another site's recommendation.
Request.Remote_AddrCharacter

The IP address of the remote client making the request. Do not attempt to use Request.Remote_Addr as a unique identifier for the session. All users behind a firewall or proxy server typically show up as a single IP address.

Request.Request_MethodCharacter
Request.Cookie is deprecated. Use the Request.HttpMethod property instead.

The request method, such as "GET" or "POST".

Request.Request_URICharacter

The requested file including any GET query string, such as " /index.html?foo=bar&this=that ".

Request.Script_NameCharacter

The requested file, such as " /index.html " (the currently running page).

Request.Server_ProtocolCharacter

The protocol used by the request, such as "HTTP/1.1" or "HTTP/1.0".

Request.UserAgentCharacter

The value of the User-Agent HTTP header, which is a string identifying the software used on the client to send this request. Replaces the Request.User_Agent property in versions 6-9.

Request.VariablesPointer

A dot variable containing all variables sent from the client. This is a combination of GET variables, POST variables, and cookies.

Methods

GetCookie Method

Returns a cookie if the cookie exists.

GetHeader Method

Get a header value as a string.

HasCookie Method

Tests if a cookie exists.

See Also