Data transmission between web pages in ASP

Source: Internet
Author: User

Abstract: web-based dynamic web page design involves data transmission between pages, Article This paper discusses common data transfer methods between web pages in ASP design, and analyzes the usage, usage, and advantages and disadvantages of various data transfer methods, these are the key considerations for choosing a data transfer method in the design phase.

Keyword data transmission variable browser webpage

Dynamic Web page technology is often used to create ASP applicationsProgramGenerally, there are at least two or more web pages. In this case, you have to consider how to transfer data between multiple web pages. The pages of ASP applications are similar to form forms of Windows applications. data transmission between forms of Windows applications can be achieved by defining global variables. Data transmission between webpages is available in a variety of ways, and the appropriate choice of data transmission between webpages plays an important role in the rationality and security of system design and operation.

1. url Method

The URL method is the most basic method for data transmission between web pages. It is easy to operate and can easily transfer data between different web pages, but its security is relatively poor. The data to be transmitted is appended to the webpage address (URL) for transmission. Such as: http://www.cstvu.com/testweb? Username = liming, where? The string that follows is the transmitted data, = the variable name before = followed by a value. You can use the request object to obtain the transmitted data. For example, request ("username "). This method shows the data content in the URL bar during data transmission, and you can see the submitted content.

2. Form Mode

By creating a form interaction area on the webpage, the user enters data in the browser and submits the data to the server through form. After the submission, the user can receive the corresponding data on the page that accepts form data, that is, you can use the request object on the Form Action page to receive transmitted data.

For example:

Sending page:

<Form name = "formtest" Action = "targetweb. asp">

<Input name = "testtext" type = "text" value = "">

<Input name = "testbutton" type = "Submit" value = "Submit">

</Form>

Receiving page: Request ("testtext ")

Use the text box on the form page to receive user data input. Use the submit button to submit and use the request to receive data on the targetweb page.

3. Cookie Method

Cookies are some small files written by the web server in the browser when browsing the page. Cookies are stored on the disk of the browser, rather than on the server. You can write a cookie when sending data, and read the cookie when receiving the data to transfer the data between web pages.

For example:

Sending page: Response. Cookies ("cookiename") ("username") = "liming"

Receiving page: request. Cookie ("cookiename") ("username ")

Assign values to the cookie variable on the sending page. The value of the cookie variable on the receiving page is the transmitted data.

4. Application Object

The application object is used to record the information of the entire website and the variables shared by different browsers. No matter how many viewers access the webpage at the same time, only one application object instance is generated. You can implement data transmission between webpages by defining the full-site application sharing variable. The definition method is: Application ("variable name") = Value

For example, application ("usrname") = Liming

The variables defined by the Application object are visible to all browsing terminals, so they are used for global data transfer shared by all browsing terminals.

5. Session Object

A session object is a variable used to record the browser. It is a dedicated variable for individual browsers. A seion object is automatically generated when each browser accesses the object. This object provides a storage space, it is used to store the variables and objects available only for the webpage opened by the visitor during the activity of the session. In this way, data used for a single browser can be transferred between the web. Definition method: Session ("variable name") = Value

For example, Session ("usename") = Liming

The variables defined by the session object are only dedicated variables at the browser end, so they are suitable for webpage data transmission between local sessions.

6. Conclusion

The above describes common methods for data transmission between webpages, each of which has its own merits. The URL method and form method are simple to implement, and simple data transmission between webpages can be realized. Generally, they are strings, which are characterized by poor security, in addition, data transmission must be performed between two consecutive pages. Cookies can only store data of the string type. to store more complex data types, you must first convert them to the string type. Operations on application objects and session objects are more complex. When using a webpage with a large volume of page views, you should clear the page as much as possible. Otherwise, a large amount of use may lead to server paralysis. Session variables are highly secure and can transmit data from a dedicated browser. The specific application determines the choice of data transmission methods. A proper choice of data transmission methods is a key factor in the design of web pages.

Related Article

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.