1. Response object The response object is an instance of the httpresponse class. This class encapsulates HTTP Response Information from ASP. NET operations.
Response Object Attributes
Bufferoutput: gets or sets a value indicating whether to buffer the output. After processing the entire page, it is sent. If it is buffered to the client output, it is true; otherwise, the value is false. The default value is true.
Cache: The httpcachepolicy object that obtains the Cache Policy (expiration time, confidentiality, and change clause) of the web page and contains information about the cache policy of the current response.
Charset: gets or sets the HTTP Character Set of the output stream.
Isclientconnected: gets a value that indicates whether the client is still connected to the server. If the client is still connected, the value is true; otherwise, the value is false.
Response object Method
Write: Write the result of the specified string or expression to the current HTTP output.
End: stop the execution of the page and get the result.
Clear: clears the cache of the current page without outputting the cached content. The clear method can be used only when the cached output is used.
Flush: displays the cached content immediately. This method is the same as the clear method. If the buffer attribute is not set to true before the script, an error occurs. Unlike the end method, this page can be executed after the method is called.
Redirect: redirect the browser Program Specified URL
2. Request object The request object is an instance of the httprequest class. It can read the HTTP value sent by the client during the Web request.
Set of request objects
Five client information retrieval sequence: querystring/form/cookies/servervariables/clientcertificate
Example: request. servervariables ("environment variable ")
3. Server Object The mappath method of the server object converts the virtual path or relative path relative to the current page to the physical file path on the Web server.
Server. mappath ("/") physical path of the home directory of the server
Server. mappath (".") physical path of the current directory
Server. mappath ("..") parent directory physical path
Response. Write ("<B> ASD </B> ")
Response. Write ("<br> ")
Response. Write server.html encode ("<B> ASD </B> ")
4. Session Object The Session object is an instance of httpsessionstate. This class provides information for the current user session. It also provides access to the cache of the session range that can be used to store information, and controls how to manage sessions.
The invention of session is to fill in the limitations of the HTTP protocol. During the HTTP protocol operation, the user sends a request and the server responds. The connection between the client and the server is discrete, non-consecutive. There is nothing in the HTTP protocol that allows the server side to track user requests. After the server responds to the user's request, the server cannot continue to connect to the browser. From the website's point of view, each new request exists independently. Therefore, a user cannot know his/her identity when switching between multiple home pages.
The Session object can be used to store the information required for a specific user session. In this way, when a user redirects between the web pages of an application, the variables stored in the session object will not be lost, but will continue to exist throughout the user session.
ASP. net sessions is very easy to use and can use session objects to fully control sessions. If you need to store information in a user session, you only need to simply call the session object directly, the following is an example:
Session ("myname") = response. Form ("username ")
Session ("mycompany") = response. Form ("usercompany ")
Obviously, for different users, the myname variable and mycompany variable of the session object are different. When each user browses between different homepage of the website, such individual variables will be retained, which is very effective as identity authentication.
Session Object Attributes
The Count attribute can help count the number of session objects in use. The statement is very simple, for example:
Response. Write (session. Count)
The timeout attribute sets the session lifetime: Session. Timeout = 5
5. Application Object Counter instance: the lock and Unlock methods ensure that only one customer can modify and access the application variable at the same time.
Application. lock'
Application ("countweb") = Application ("countweb") + 1' accumulators, click count plus 1
Application. Unlock
Response. write "the total number of clicks on this page before the Web server is shut down and restarted:" & Application ("countweb ")
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service