Today I will mainly introduce the following knowledge points:
Request
Response
Server
Session
Cookie
Application
<%%>及<%=%>表达式
To be exact, ASP.net does not have built-in objects this said, JSP really put request, response these as a JSP built-in objects, here is just borrowed a JSP of the argument just. Many of the above are objects that you can use when doing asp.net development without new (there are also many, in asp.net, all pages are inherited from the System.Web.UI.Page class, which is referred to as the properties of the page class).
In the center of the web is a Web server that handles the HTTP requests of the client. Because HTTP is a stateless protocol, it does not remember the last time anyone asked for it, not actively ask the client, only when the client actively requested, the server will respond.
Request
Request encapsulates the client solicitation information. The common properties of the request are as follows:
| Property name |
Value type |
Description |
| Applicationpath |
String |
Gets the root path of the requested resource on the site |
| ContentEncoding |
Encoding |
Set the encoding of the request object |
| Cookies |
HttpCookieCollection |
A collection of cookies sent by the client to the server |
| QueryString |
NameValueCollection |
Collection of query strings for the current request |
| Urlreferrer |
Uri |
Gets which URL the user jumps to the current page |
Response
The response represents the server response object. Each time a client makes a request, the server uses a response object to process the request, and after the request is processed, the server destroys the corresponding object so that it can continue to accept other customer service requests.
Response Common properties are as follows:
| Property name |
Value type |
Description |
| Charset |
String |
Represents the character set used by the output stream |
| ContentEncoding |
Encoding |
Set the encoding of the output stream |
| ContentLength |
Int |
byte size of output stream |
| ContentType |
String |
HTTP MIME type of output stream |
| Cookies |
HttpCookieCollection |
A collection of cookies sent by the server to the client |
| Output |
TextWriter |
The character output stream of the server response object |
| Redirectlocation |
String |
REDIRECT the current request |
Response Common methods
| Property name |
return value type |
Description |
| AppendCookie |
void |
Adds a cookie to the cookie collection of the Response object |
| Clear |
void |
Empty all content output in the buffer |
| Close |
void |
Close the current server to the client connection |
| End |
void |
Terminates the response and sends the output from the buffer to the client |
| Redirect |
void |
REDIRECT Current request |