The purpose of the ASP is to learn

Source: Internet
Author: User

First, overview


second, specific introduction

1. Request Object

The Request object is used to obtain all the information that the client provides when requesting a page or transmitting a form. This contains HTTP variables that can identify the browser and the user. The cookie information stored in the client and the value appended to the URL (the value within the HTML control in the query string or in the < form> section of the page).

Property


Method

                   

2. Response Object

The Response object is used to access the response of the client that was created. and outputs information to the client, which provides an HTTP variable that identifies the server and performance, the information sent to the browser, and the information stored in the cookie. It also provides a series of methods for creating output pages. such as the ubiquitous response. Write method.

Property

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvdtaxmde2ode2ma==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">

Method


3. Application Object

in an ASP. NET environment, the application object is from the Httpapplictionstat class.

It can share common information between multiple requests, connections, and can act as a conduit for information passing between each request connection .

Use the Application object to save the variables we want to pass.

Because the Application object is valid throughout the lifetime of the application, it can be accessed on different pages. It's as convenient as using global variables.


Property


Method


                   

4. Session Object

The Session object is a number that the server gives to the client .

When a webserver is executed, there may be several users browsing the site on this server. When each user first establishes a connection to this wwwserver. He set up a session with the server, at the same time, the server will voluntarily assign it a sessionid. The unique identity used to identify the user.

in particular, the variables of the session object are only valid for one user, and the session information of different users is stored with the variables of different session objects.

In the network environment, the variables of the session object have a life cycle. The system terminates these variables if the variables of the session object are not refreshed at the specified time.

Property


Method

                   

5. Server Object

The server object provides access to the methods and properties on the server. Most of the methods and properties are serviced as useful programs.

The server object is also one of the members of the Page object, providing some of the functionality needed to handle page requests , such as building COM objects, compiling code for strings, and so on.

Property


Method

                   

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvdtaxmde2ode2ma==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">


third, the key to grasp

1. Request object interacting with response object

the required number of parameters is obtained by the request object first. form form data is submitted to the server in two ways:get and post .


(1) Get is the URL in which the parameter data queue is added to the Action property of the submission form, and the value is corresponding to each field one by one in the form, which can be seen in the URL.

Post is the HTTP post mechanism that places the fields within the form with their contents in the HTML header, along with the URL address referred to by the Action property.

the user does not see the process .


(2) for get mode, the server side uses request.querystring[] to get the value of the variable .

for post mode, the server side uses Request.Form. Get () or request[] Gets the submitted data .


(3) The amount of data sent by get is small . cannot be greater than 2KB.

Post transmits a large amount of data , which is generally not limited by default. In theory, however, the maximum amount of IIS4 is 100KB in 80KB,IIS5.


(4) get security is very low, post security is high .

because the Get method transmits data with certain restrictions and is not secure. Therefore, the form generally does not use the Get method.


After the server passes the processing. The information is passed back by the response object . There are several ways to do it.


(1 ) Direct output: Response.Write (variable data or string) such as:

Response.Write ("<script Language=javascript>alert (' Welcome to learn ASP] </script>")


(2) linking to other Web pages:The redirect method of the Response object redirects the client browser to a different URL. That is, jump to another page. For example:


(3 ) terminates execution of the current page: Response.End ()


(4 ) output The specified file: Response.WriteFile (filename) filename refers to the file name of the file to be output to the browser


2. Lock and unlock in Application object

There may be situations where multiple users access the same Application object at the same time.

This makes it possible for multiple users to change the same application named object, resulting in inconsistent data issues.

 
            The HttpApplicationState class offers two methods of Lock and Unlock. To resolve an access synchronization issue with the Application object. A . &NBSP

            about lock and unlock  
            Lock: Application.Lock ()  
            interview: Application ("key name") = value  
            unlock: Application.UnLock ()  
            Note: lock method and Unlock method should be used in pairs .

3. The advantages of the Session object

watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvdtaxmde2ode2ma==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">

Related reading: ASP. NET built-in objects



The purpose of the ASP is to learn

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.