Common use of the use of Response objects

zhaozj2021-02-16  65

Each program language or development tool has a certain function to communicate with the user, and the ASP is the same. The object that is transmitted to the user in the ASP is

Response object.

The Response object is used to dynamically respond to client requests and return dynamically generated response results to the client browser, use

The Response object can 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 wide in ASP programming and is also a very easy to use. Let's take a look

Response object:

grammar:

Response.collection | Property | Method

First, collection

The Response object has only one collection - the cookies, the cookies data collection allows data to be set in the client's browser. Create it if the specified cookie does not exist. If there is, the data is automatically updated.

grammar:

Response.cookies (cookie) [key.attribute]

The cookie here is the name of the specified cookie. And if Key is specified, the cookie is a dictionary. Attribute specifies information about cookie itself. Attribute parameters can be one of the following:

Domain is only written. If it is specified, the cookie will be sent to the request for the domain.

EXPIRES is only written. Specifies the expiration date of the cookie. In order to store the cookie on the client disk after the session, you must set this date. If the settings of this attribute do not exceed the current date, the cookie will expire after the task is completed.

Haskeys is read-only. Specifies whether cookies contains a keyword.

Path is only written. If it is specified, the cookie will only be sent to the request to the path. If this property is not set, the path to the application is used.

Secure is only written. Specifies whether cookies are 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

Add a new HTML title to your response. Name is the name of the new HTML title. Value is the value of the target. You can add any name and any value of the HTML title. It does not replace the existing same name title. Once the title is added, it will not be deleted.

Response.appendtolog string

Add a string to the end of the log of the web server. String is a string to add to the log file.

Response.binaryWrite Data

The method can write the formulated information to the HTTP output without any character transition, mainly for writing non-string information (such as binary data required by the client application, etc.). DATA is the data to be sent.

Response.clear

Delete all HTML outputs of the buffer, but only delete the response body without deleting the response title. You can use this method to handle error conditions. What to pay attention is, if

Response.buffer is set to TRUE, the method will result in an error.

Response.end

Forcing the Web server stops performing more scripts and sends current results, the remaining content in the file will not be processed. in case

RESPONSE.BUFFER is set to TRUE, then call

Response.end will buffer output.

Response.flush

For a buffer response, all buffer information is sent. If the response.buffer is set to TRUE, the method will result in an error.

Response.Redirect URL

Redirect the client's browser to a new Internet address. The URL is the Internet address of the new web page.

Response.Write Variant

Response.write is

The RESPONSE object is the most commonly used method, which can send a string to the browser. Variant is a string or a variable having a string value.

Third, attribute

Response.buffer

Buffer an Active Server page. The response is only to a page or

Response.flush or

The response.end method is sent to send it. The server will not set the buffer attribute after sending the output to the client.

Response.cacheControl

Indicates whether the Proxy server can cache Active Server Page. By default, its value is false. When setting its properties as public, the Proxy server can buffer the output generated by the ASP.

Response.charset (charsetname)

Attach the character set name (such as GB) to

Behind the Content-Type title in the Response object, used to set the web server response to the client's file character encoding. A possible value is "ISO_LATIN_1".

Response.ContentType

Indicates the type of response. Possible values ​​are Text / Plain and Image / GIF, default TEXT / HTML.

Response.expires

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

Response.expiresabsolute

The browser can no longer cache the date and time of the current page. You can return it before you have not expired. If not specified, the home page expires at midnight at midnight; if the date is not specified, the time expires to the day.

TRUE / FALSE =

Response.isclientConnected

Attribute is read-only, specifying the last call

After response.write, the client is still connected to the server. This attribute allows users to have more controls in the case where the client and the server are not connected. For example, in the case where the request is made from the client to the server, it will be used for a long time, which may help ensure that the client is still connected before the scripting is continuing. Have value true or false.

Response.pics (PICS string)

The PICS level used to add a web page. The PICS level indicates the content level, such as violence or pornography, etc.

Response.status = "Status Description Strings"

The value used to set the status line to be responsive to the web server.

The original source: http: //www.wrclub.net/show.aspx id = 1529 Author:? Fuxing (ie me)

转载请注明原文地址:https://www.9cbs.com/read-15170.html

New Post(0)