Request and response of six objects in Asp.net
The six objects in ASP. NET are essentially only attributes in context, not objects strictly.
1. Request --> Read the value sent by the client during the Web Request
2. Response --> encapsulate the output returned to the HTTP client after the page execution period
3. Server --> provides access to properties and methods on the server
4. Application --> Status objects acting on the entire Runtime
5. session --> session state persistence object, used to track sessions of a single user
6. Cookie --> one way for the client to keep session information
Request--> Read the value sent by the client during the Web request, that is, read the request message data sent from the browser.
To read HTTP request message data, you must understand the data submitted by the browser.
There are two main types: one is the parameters sent from the form using post, and the data exists in the Request Message style. Correspondingly, on the server side, the method for obtaining data submitted by the browser is context. Request. Form ["XXX"].
The other is through the URL parameter (which is consistent with the parameters sent from the form using get), and the data exists in the URL string. The method for obtaining the data is context. Request. querystring ["XXX"].
In addition, you can directly use context regardless of the data submitted by the browser. request ["XXX"] to read data, which is also feasible, but the effect is reflected in efficiency, directly using context. request ["XXX"] to read data is certainly slower, which is the difference between large-scale retrieval and small-scale retrieval.
Response--> Encapsulates the output returned to the HTTP client after the page execution period, that is, the HTTP response packet data.
Its Class Name Is httpresponse
Attributes and Methods
Write () sends string information to the client
Whether the bufferoutput attribute uses Cache
Clear () Clear Cache
Flush () forces the output of all cached data
Redirect () webpage redirection address
End () stops running the current page
Writefile () reads a file and writes it to the client output stream (essence: open the file and output it to the client .)
1. response. Write variable data or string
Response. Write (variable data or string)
2. The redirect method of the response object redirects the client browser to another URL to jump to another webpage.
For example:
Response. Redirect ("http://www.cnblogs.com/crazypig ")
3. response. End () Terminate the running of the current page
4. response. writefile (filename)
Filename indicates the name of the file to be output to the browser.