The _asp basis of data transfer mode between Web pages in ASP

Source: Internet
Author: User
Tags numeric value
Absrtact: web based Dynamic Web page design will involve the data transfer between pages, this paper discusses the methods of data transfer between Web pages commonly used in ASP design, analyzes the usage of various data transfer methods, their use situations and their advantages and disadvantages, which are the key to the choice of data transmission mode in design stage.

Keyword data transfer variable browser-side web page

Often when using Dynamic Web page technology to make ASP applications typically have at least two or more than two Web pages, it is time to consider the process of passing data across multiple Web pages. The individual pages of an ASP application are similar to the form forms for Windows applications, and data transfer between each form of a Windows application can be accomplished by defining global variables. There are many different ways to use data transfer between Web pages, and it is very important to choose whether the data transfer mode is appropriate to the rationality and security of system design and operation.

1, URL Way

The URL method is the most basic method to realize the data transfer between the Web, the operation is simple, the data transfer between different Web pages can be easily realized, but its security is comparatively poor. The data to be passed is appended to the page address (URL) for delivery. such as: Http://www.cstvu.com/testweb?username=liming, Which? The string followed is the data passed, = the previous variable name, = the number followed, the request object can be used to get the passed data. such as: Request ("username"). In the process of passing data, the data content is displayed in the URL bar, and the user can see the content submitted.

2, Form mode

By making a form interactive area on a Web page, the user enters data in the browser, then submits it to the server through a form, and receives the corresponding data on the page after submitting the form data, that is, the action page of the form can use the request object to receive the data that is passed.

Such as:

Send page:

<form name= "Formtest" action= "targetweb.asp"

<input name= "Testtext" type= "text" value= "" "

<input name= "Testbutton" type = "submit" value = "Commit"

</form>

Receive page: Request ("Testtext")

Use the form page's text box to receive input from the user's data and use request to receive the data in the Targetweb page after submitting the Submit button.

3. Cookie method

Cookies are small files that the Web server writes to the browser at the time the page is browsed, and cookies are stored on the browser-side local disk rather than on the service side. You can write cookies when you send data, and read cookies when you receive them to complete the transfer of data between Web pages.

Such as:

Send page: Response.Cookies ("CookieName") ("username") = "Liming"

Receive page: Request.cookie ("CookieName") ("username")

To assign a value to a cookie variable in the sending page, the value of the cookie variable in the receiving page is the data that is passed.

4, Application Object

Application objects are used to record the entire site information, is to record different browser-side shared variables, no matter how many browsers access to the Web page, will only produce a Application object instance. Users can implement data transfer between Web pages by defining application whole station share variables. The method is defined as: application ("variable name") = numeric value

such as: Application ("Usrname") =liming

The variables defined by the Application object are visible to all browsing ends, so their use is global data transfer shared by all browsing ends.

5. Session Object

The session object, which is used to record browser-side variables, is a specific variable in the individual browser-side, and automatically generates a Seseion object for each browser access, which provides a storage place to store variables and objects that are available only to pages that the visitor opens during the session's activity. This allows you to use data that can be used to pass between the web for a single browser-side. Its definition method: Session ("variable name") = numeric value

such as: Session ("Usename") =liming

The variable defined by the Session object is only a dedicated variable on the browser side, so it is suitable for Web page data transfer between local sessions.

6. Concluding remarks

     described above is the data transmission between the common methods of the Web, with a few advantages. The way of URL and form method is simple, can realize simple data transfer between pages, generally for string type, its characteristics are poor security, and must be continuous access to the data transfer between the two pages. Cookies can only hold data of type string, and if you want to store more complex data types, you must first convert it to a string type. Application object and Session object operation is relatively complex, browsing a very large web page should be used in moderation, and after the end of use to remove as far as possible, otherwise a large number of use may cause the server paralysis. Session variables are more secure and can be passed through private browsing-side data. The specific application determines the choice of data transmission mode, and the choice of reasonable data transmission is the 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.