Online Book Reader

Home Category

Programming Microsoft ASP.NET 4 - Dino Esposito [344]

By Root 5494 0
being issued.

Table 16-12. Properties Describing the Request Type

Property

Description

AcceptTypes

Gets an array of strings denoting the list of MIME types supported by the client for the specified request.

AnonymousID

Indicates the ID of the anonymous user, if any. The identity refers to the string generated by the AnonymousIdentification module and has nothing to do with the identity of the IIS anonymous user.

Browser

Gets an HttpBrowserCapabilities object that contains information about the capabilities of the client’s browser.

ContentEncoding

Gets or sets an Encoding object that represents the client’s character set. If specified, this property overrides the ASP.NET default encoding.

ContentLength

Gets the length in bytes of the content sent by the client.

ContentType

Gets or sets the MIME content type of the incoming request.

CurrentExecutionFilePath

Gets the current virtual path of the request even when the client is redirected to another page via Execute or Transfer. The FilePath property, on the other hand, always returns the path to the originally requested page.

FilePath

Gets the virtual path of the current request. The path doesn’t change in cases of server-side page redirection.

HttpMethod

Gets a string that denotes the HTTP method used for the request. Values are GET, POST, or HEAD.

RequestType

Gets or sets a string that denotes the HTTP command used to issue the request. It can be GET or POST.

TotalBytes

Gets the total number of bytes in the input stream. This property differs from ContentLength in that it also includes headers.

UserAgent

Gets a string that identifies the browser. This property gets the raw content of the user agent header.

The anonymous ID is usually transmitted through a cookie (whose default name is .ASPXANONYMOUS) and serves the purpose of giving an identity to nonauthenticated users, mainly for user profile functions. The anonymous ID is a GUID and is transmitted as clear text. It doesn’t play any relevant role with authentication and security; it is merely a way to track nonregistered users as they move around the site. (See Chapter 7 for profiles and Chapter 19, for user authentication.)

Initially, CurrentExecutionFilePath and FilePath share the same content—the requested URL. However, in cases of server-side redirects, the value of CurrentExecutionFilePath is automatically updated. You should check CurrentExecutionFilePath for up-to-date information about the target URL.

The HttpBrowserCapabilities object groups in a single place values that identify a fair number of browser capabilities, including support for ActiveX controls, scripting languages, frames, cookies, and more. When the request arrives, the user agent information is used to identify the requesting browser and an instance of the HttpBrowserCapabilities class is created and populated with browser-specific information. The information is in no way dynamically set by the browser; instead, it is retrieved from an offline server-side repository.

Information from the Client


Table 16-13 lists the HttpRequest properties that expose the client data that ASP.NET pages might want to use for server-side processing. The following table includes, for example, cookies, forms, and query string collections.

Table 16-13. Properties Describing the Client Data

Property

Description

ClientCertificate

Gets an HttpClientCertificate object with information on the client’s security certificate settings, if any. The certificate object wraps up information such as number, validity, and issuer of the certificate.

Cookies

Gets a collection representing all cookies sent by the client. A cookie is identified by the HttpCookie object.

Files

Gets a collection of client-uploaded files. The property requires the HTTP Content-Type header to be set to multipart/form-data.

Filter

Gets or sets a Stream-based object through which all HTTP input passes when received. The filtered input is anything read via InputStream.

Form

Gets a name-value collection filled with the

Return Main Page Previous Page Next Page

®Online Book Reader