Request and Response objects

Source: Internet
Author: User
Tags object character set header iis variables string valid access
The details of the Request|response| object's ability to apply customer requests and server responses from the ASP are implemented through the ASP's built-in request and response objects.
· Request object: Provides the script with all the information the client provides when the client requests a page or passes a form. This includes an HTTP variable that indicates the browser and the user, a cookie stored in the browser under the domain name, any string that is appended to the URL as a query string, or the value of the HTML control in the <FORM> section of the page. Also provides authorization access using secure Socket Layer (SSL) or other cryptographic communication protocols, and properties that help manage the connection.
· Response object: Used to access the response information created on the server side of the concurrency back to the client. Provides the HTTP variables for the script, indicating the capabilities of the server and server and information about what to send back to the browser, and any new cookies that will be stored in the browser for this domain. It also provides a series of methods for creating output, such as the ubiquitous Response.Write method.
1, the Request object member's summary
A) collection of request objects
Object Invocation Method: Request.Cookies ("UserName") =username
The Request object provides 5 collections that you can use to access the various types of information that the client requests from the Web server, which are set out in the following table:
Collection and description of the request object
Collection Name: ClientCertificate
Description: When a client accesses a page or other resource, the numeric collection of all fields or entries for the client certificate that is used to identify the server, and each member is read-only
Collection Name: Cookies
Description: A collection of the values of all cookies issued by the user system, based on the user's request, that are valid only for the corresponding domain, and each member is read-only
Collection Name: Form
Note: When the property value of method is post, all the values of the HTML control cells in the <FORM> section that are submitted for the request are set, each member is read-only
Collection Name: QueryString
Description: The name/value pairs that are appended to the URL of the user request, or the value of all HTML control cells in the <FORM> that are submitted as a request and the method property is a get (or omit its properties), and each member is read-only
Collection Name: ServerVariables
Description: HTTP header values issued with the client request, and a collection of the values of several environment variables for the Web server, each member is read-only


b) The properties of the Request object
The request object's unique properties and description, which provides information about the number of bytes requested by the user, is rarely used for ASP pages, and we usually focus on the specified value rather than the entire request string.
Properties: Totlbytes
Description: Read-only to return the entire number of bytes requested by the client

c) The method of the Request object
The only method of the request object and its description, as shown in the following table, allows access to the complete contents of the user Request section that is passed to the server from a <FORM> segment.
Method and description of the request object
Method: BinaryRead (count)
Note: When data is sent to the server as part of a POST request, a Variant array (or SAFEARRAY) is obtained from the customer request for the count byte data. This method is not available if the ASP code already references the Request.Form collection. Also, if you use the BinaryRead method, you cannot access the Request.Form collection

2, Response Object member overview
A) A collection of response objects
The response object has only one collection, as shown in the following table, which sets the value of the cookie that you want to place on the client system, which is directly equivalent to the Request.Cookies collection.
Collection and description of response objects
Collection Name: Cookies
Note: In the current response, the value of all cookies sent back to the client, this collection is write-only

b) Response properties of the object
The response object also provides a series of properties that can be read (in most cases) and modified so that the response adapts to the request. These are set by the server and we do not need to set them. It is important to note that when certain properties are set, the syntax used may differ somewhat from what is commonly used.
Properties and descriptions of response objects
Properties: buuffer=true| False
Description: Read/write, Boolean, indicating whether the output created by an ASP page has been stored in the IIS buffer until all server scripts for the current page have been processed or the flush, end method is invoked. This property must be set before any output, including HTTP submission information, is sent to IIS. Therefore, in the. asp file, this setting should be <% @LANGUAGE the first line following the =...%> statement. The ASP 3.0 default is buffered to open (True) and the default is off in earlier versions (FALSE)

Properties: CacheControl "Setting"
Description: Read/write, character type, set this property to "public" allows the proxy server to cache pages, such as "Private" to prevent proxy server caching from occurring

Attribute: charset= "value"
Description: Read/write, character type, and enclose the character set name (for example: iso-latin-7) in the HTTP Content-type header created by the server for each response

Properties: Content type= "Mime-type"
Description: Read/write, character type, indicating the HTTP content type of the response, standard MIME type (such as "Text/xml" or "image/gif"). If the default indicates that the MIME type "text/html" is used, the content type tells the browser what type of content is expected

Properties: Expires minutes
Description: Read/write, a numeric type that indicates the length of time the page is valid in minutes, and if the user requests the same page before its full validity period, the contents of the display buffer will be read directly, after which the page will no longer remain in the private (user) or public (proxy server) buffer

[1] [2] Next page



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.