1. Response object
The Response object is an object of the HttpResponse class. In Response to an HTTP Response, the attributes and methods of this object can be used to control how server-side data is sent to the client browser.
(1) attributes of the Response object
N Buffer: indicates whether the page output is buffered.
N BufferOutput: whether to buffer the output and send it after processing the entire page.
N Cache: gets the Cache policy of a web page (expiration time, confidentiality, and change clause ).
N Charset: gets or sets the HTTP Character Set of the output stream.
N ContentEncoding: gets or sets the encoding format of the content.
N ContentType: gets or sets the http mime type of the output stream.
N Expires: gets or sets the number of minutes before the page cached on the browser Expires. If you return the same page before the page expires, the cached version is displayed. Expires is provided to be compatible with previous ASP versions.
N ExpiresAbsolute: gets or sets the absolute date and time when the cache information is removed from the cache. ExpiresAbsolute is provided to be compatible with the previous ASP version.
N Filter: gets or sets a packaging Filter object, which is used to Filter the HTTP entity before transmission.
N IsClientConnected: indicates whether the client is still connected to the server.
N Output: return the text Output of the HTTP Response stream.
N OutputStream: returns the binary output stream of the Http Content body.
N Status: Set the Status bar returned to the client.
N StatusCode: gets or sets the HTTP status code returned to the client. The client can know the running status of the server through the HTTP status code.
N StatusDescription: gets or sets the HTTP status string returned to the client.
N SuppressContent: whether to send HTTP content to the client.
(2) method of the Response object
N BinaryWrite: writes a binary string to the HTTP output stream.
N Clear: clears all content output from the buffer stream.
N ClearContent: clears all content in the buffer stream.
N ClearHeaders: clears all header information in the buffer stream.
N Close: Close the socket connection to the client.
N End: sends all the current buffered output to the client, stops the execution of the page, and triggers the Application_EndRequest event.
N Flush: sends all current buffer output to the client. Both the Flush method and the End method can send buffered content to the client for display. However, the difference between Flush and End is that Flush does not stop page execution.
N Write: used to Write information to the output stream and output it to the client for display.
N WriteFile: directly writes the specified file to the output stream for display.
N Redirect: transfers the browser to another specified webpage.
2. Request object
The Request object is actually the HttpRequest class object in the System. Web namespace. When the customer sends a request to execute ASP. the Request information of the client is encapsulated in the Request object. The Request information includes the Request Header, the machine information of the client, and the browser information of the client, request methods (such as POST and GET) and submitted form information.
(1) attributes of the Request object
N AcceptTypes: String Array of MIME accept types supported by the client.
N ApplicationPath: root path of the virtual application of ASP. NET applications on the server.
N Browser: information about the Browser functions of the client being requested.
N ClientCertificate: The Client Security Certificate currently requested.
N ContentEncoding: or set the character set of the entity body.
N ContentLength: specify the length (in bytes) of the content sent by the client ).
N ContentType: the MIME content type of the incoming request.
N Cookies: a set of Cookies sent by the client.
N CurrentExecutionFilePath: Specifies the virtual path of the current request.
N FilePath: the virtual path of the current request.
N Form: a set of Form variables.
N Headers: HTTP header set
N IsAuthenticated: whether the user is verified.
N HttpMethod: the HTTP data transmission method (such as GET, POST, or HEAD) used by the client ).
N IsSecureConnection: whether to use secure sockets (HTTPS) for HTTP connections ).
N Path: the virtual Path of the current request.
N PhysicalApplicationPath: physical file system path of the root directory of the currently running server application.
N QueryString: a collection of HTTP query string variables.
N PhysicalPath: Obtain the physical file system path corresponding to the requested URL.
N RawUrl: the original URL of the current request.
N RequestType: the HTTP data transmission method (GET or POST) used by the client ).
N ServerVariables: a set of Web server variables.
N Url: the URL of the current request.
N UserAgent: User Agent information of the client browser
N UserHostAddress: Host address of the client.
N UserHostName: the DNS name of the client.
N userages: the sorting string array of client language preferences.
(2) Request object application (1) -- obtain client form information
In Web applications, some information is often entered in a page, and then submitted to the server. The Request object can be used to obtain information about submitted client forms. Depending on the method used to submit information, the Request object can use the QueryString and Form attributes to obtain the Form information of the client.
1. When a user submits Form information through the POST method, the Form information can be obtained through the Form attribute.
Usage: Request. Form ["Control name"]
2. When you submit form information through the GET method, QueryString can be used to obtain form information.
Usage: Request. QueryString ["Control name"]
(3) Request object application (2) -- get client browser Information
The Browser attribute of the Request object can be used to obtain information about the client Browser. This attribute is actually an HttpBrowserCapabilities object. For the properties of the HttpBrowserCapabilities object, see the example.
(4) Request object application (3) -- obtain other client information
You can also obtain other information about the client through the properties of the Request object. For example, you can obtain the user agent information of the client browser through the UserHostAddress attribute and obtain the host address of the client through the UserHostAddress attribute.
In addition, the Request object Headers attribute can be used to obtain the HTTP header information.
3. Server Object
The attribute of the Server object reflects the various information of the Web Server, which provides various services that the Server can provide.
Server Object Attributes and methods:
N MachineName property: gets the name of the server's computer.
N ScriptTimeout attribute: Get and set the request timeout (in seconds.
N GetLastError method: You can obtain the previous exception. When an error occurs, you can use this method to access the error message. The ClearError method can be used to clear the previous exception.
N Transfer method: Used to terminate the execution of the current page and start executing a new page for the current request.
N MapPath method: The application returns the physical file path corresponding to the specified virtual path on the Web server.
N HTMLEncode: encode the text to be displayed in the browser.
N HTMLDecode method: it is the reverse operation of the HTMLEncode method.
N UrlEncode: encode the hyperjoin string.
UrlDecode method: Anti-operation of UrlEncode Method
Author: "He Junfeng blog"