The use of common response objects in Xiang-solution

Source: Internet
Author: User
Tags date object character set end flush header string variable
Response| object each program language or development tool has a certain function to communicate with the user, the same is true of ASP. The object that is responsible for passing information to the user in the ASP is the response object. The response object is used to dynamically respond to client requests and to return dynamically generated response results to the client browser, using the response object to send information directly to the browser, redirect the browser to another URL, or set the value of the cookie, and so on. The response object is very extensive in ASP programming and is also a very useful tool. Here's a concrete look at the response object:

Grammar:
Response.collection|property|method

One, set
Response objects have only one collection--cookies,cookies data sets allow data to be set in the client's browser. If the specified cookie does not exist, it is created. If present, the data is automatically updated.

Syntax: Response.Cookies (Cookie) [Key.attribute]

The cookie here is the name of the specified cookie. If a key is specified, the cookie is a dictionary. attribute specifies information about the cookie itself. Attribute parameters can be one of the following:

Domain write only. If specified, the cookie is sent to the request in the domain.

Expires only write. Specifies the expiration date for the cookie. To store cookies on the client disk after the session has ended, you must set the date. If the setting for this property does not exceed the current date, the cookie expires after the task ends.

HasKeys Read only. Specifies whether the cookie contains keywords.

Path is write only. If specified, the cookie is sent only to the request for that path. If this property is not set, the path to the application is used.

Secure only write. Specifies whether the cookie is safe.

Example:

<%
Response.Cookies ("Wrclub") ("weburl") = "Http://www.wrclub.net"
Response.Cookies ("Wrclub"). Path= "/wrclub/"
Response.Cookies ("Wrclub"). expires= #2003 -11-30#
%>

Second, the method

Response.AddHeader Name,value

Adds a new HTML caption to the answer. Name is the new HTML title. Value is the values of the header variable. You can add any name and any value to the HTML caption. It does not replace an existing title with the same name. Once the caption is added, it cannot be deleted.

Response.appendtolog String

Adds a string to the end of the log entry for the Web server. String to be added to the log file.

Response.BinaryWrite Data

This method can write information to the HTTP output without any character conversion, and is mainly used to write information that is not string, such as binary data required by client applications, etc. Data is what you want to send.

Response.Clear

Deletes all HTML output from the buffer, but deletes only the response body without deleting the response header. You can use this method to handle error conditions. It should be noted that if Response.Buffer is set to True, this method will cause the run to be an error.

Response.End

Force the Web server to stop executing more scripts and send the current result, and the remaining content in the file will not be processed. If Response.Buffer is set to True, the call to Response.End will buffer the output.

Response.Flush

For a buffered response, send all the buffered information. If Response.Buffer is set to True, the method will cause the run to be an error.

Response.Redirect URL

Redirects the client's browser to a new Internet address. The URL is the Internet address for the new page.

Response.Write Variant

Response.Write is the most common method for Response objects, which can send strings to the browser. A variant is a string or a variable that has a string value.

Third, the property

Response.Buffer

Buffers an active Server Page. Response only to a page end or Response.Flush or Response.End method call Chicai sent out. The server will not be able to set the buffer property after the output is sent to the client.

Response.CacheControl

Indicates whether the proxy server can cache Active Server Page. By default, its value is false. When you set its properties to public, the proxy server can buffer the output generated by the ASP.

Response.Charset (CharsetName)

Attaches a character set name (such as GB) to the response object, after the Content-type header, to set the file character encoding that the Web server responds to the client. One possible value is "iso_latin_1".

Response.ContentType

Indicates the type of response content. The possible values are Text/plain and image/gif, and the default value is text/html.

Response.Expires

The length of time, in minutes, that the browser can cache the current page.

Response.ExpiresAbsolute

The browser can no longer cache the date and time of the current page. Can be returned before it expires. If no time is specified, the home page expires at midnight on the same day, and if no date is specified, the specified time of day expires.

True/false = response.isclientconnected

property is read-only to indicate whether the client is still connected to the server since the last call to Response.Write. This property allows the user to have more control when the client and server are not joined. For example, this may help ensure that the client is still connected before proceeding with the script, when the request is made from the client and the server makes the appropriate use for a long period of time. Has a value of true or false.

Response.PICS (PICS string)

The pics level used to add pages. The pics level indicates the content level of a Web page, such as the degree of violence or pornography.

Response.Status = "Status Description string"

The value used to set the status row for the Web server to respond to.



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.