Common use of the use of Response objects

zhaozj2021-02-16  50

Each program language or development tool has a certain function to communicate with the user, and the ASP is the same. The object that passes the information to the user in the ASP is the response object. The Response object is used to dynamically respond to client requests, and return dynamically generated responses to the client browser, use the Response object to send information to the browser, redirect the browser to another URL or set cookie Value, etc.. The Response object is very wide in ASP programming and is also a very easy to use. Let's take a specific look at the response object: Syntax: response.collection | Property | Method 1, Collection Response object has only one collection - bookies, cookies data set 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. Syntax: 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") = "http://www.wrclub.net" response.cookies ("wrclub") .path = "/ wrclub /" Response.cookies (" Wrclub "). Expires = # 2003-11-30 #%> Second, 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 entries of the web server. String is a string to add to the log file. Response.binaryWrite Data This method can write the formulated information to the HTTP output without any character transition, primarily for writing non-string information (such as binary data required by the client application). DATA is the data to be sent. Response.clear Removes all HTML outputs of the buffer, but only deletes the response body without deleting the response title. You can use this method to handle error conditions. It should be noted that if response.buffer is set to TRUE, the method will result in an error. The response.end forces the Web server stops performing more scripts and sends current results, and the remaining content in the file will not be processed. If Response.Buffer is set to True, call Response.end to output buffer. Response.flush For a buffer, send all buffer information.

If the response.buffer is set to TRUE, the method will result in an error. The Response.Redirect URL redirects the client's browser to a new Internet address. The URL is the Internet address of the new web page. Response.write VariantResponse.write is the most common way to response object, which can send a string to your browser. Variant is a string or a variable having a string value. Third, the property response.buffer buffers an Active Server page. The response is only sent to a page or the response.flush or response.end method is called. 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) Addition of the character set name (such as GB) to the back of 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. The Response.expires browser can cache the length of time in the current page, in minutes. The response.expiresabsolute 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 property is read-only, indicating whether the client is still connected to the server after the last call response.write. 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) is used to add a PICS level of the web page. The PICS level indicates the content level, such as violence or pornography, etc. Response.status = "Status Description String" is used to set the value of the status row to be in response to the Web server. The original source: http: //www.wrclub.net/show.aspx id = 1529 Author:? Fuxing (ie me)

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

New Post(0)