Talking about the data transfer between web pages in ASP

xiaoxiao2021-03-06  59

Since the antenna network often uses dynamic web technology to make an ASP application, there is generally at least two or more web pages, and you have to consider the processing of data between multiple web pages. The respective pages of the ASP application are similar to the FORM form of the Windows application, and the Windows applications can be implemented by defining a global variable. Data delivery between the webpages has a variety of different ways, and the data transfer mode between the web page selection is appropriate to raise a lightweight effect on the rationality and security of system design and operation.

1, URL method

The URL mode is the most basic method of implementing the Web data delivery, and the operation is simple, and the data delivery between different web pages can be easily implemented, but its security is relatively poor. The data to be passed is attached to the web address (URL). Such as http://www.cstvu.com/testweb?username=liming, where? The string followed by the following is the transferred data, = before the variable name, = after the value, you can use the Request object to get the passed data. Such as: Request ("UserName"). This method is displayed in the URL column during transmission data, and the user can see the submitted content.

2, form

By making a form interaction area on the web, the user enters the data in the browser side, then submitted to the server via the Form, and the corresponding data can be received in the page submitted after receiving the FORM data, that is, the form of the form can be used. Objects to receive the transmitted data.

Such as:

Send a page:

Receive page: Request ("TestText")

Using the text box of the FORM page to receive the input of the user data, use the request to receive data using the request to receive data after submitting through the Submit button.

3, cookie mode

Cookie is some small files written in the browser end when browsing the page, and cookies is stored on the browser-terminal disk instead of storing on the server. You can write a cookie when you send data, and read the Cookie completed the transfer between the web page when receiving.

Such as:

Send Page: Response.cookies ("cookiename") ("UserName") = "limited"

Receive page: Request.cookie ("cookiename") ("Username")

Assign a value to the cookie variable in the send page, the value of the Cookie variable in the receiving page is the transmitted data. 4, Application object

The Application object is used to record the entire website information. It is a variable that records different browser-side sharing, whether there are several viewers to access the web page, will only generate an instance of an Application object. Users can implement data delivery between the web pages by defining the Application Splearate Shared Variable. Its definition method is: Application ("Variable Name) = Numerical As: Application (" USRNAME ") = liming

The variable defined by the Application object is visible for all browsing, so its use occasion is global data transfer shared by all browsing.

5, session object

The session object is used to record the variable of the browser side, which is a variable dedicated to the individual browser. It will automatically generate a Seseion object for each browser access. This object provides a storage site, which is used to store only the visitor. The variables and objects available from the web page open during the event of the session. This uses data that can be used to deliver a single browser side between the Web. Its definition method: session ("variable name) = value

Such as: session ("usename") = limited

The variable defined by the Session object is only a dedicated variable of the browser, so it is suitable for web data transfer between the local session.

6, conclude

The above introduction is a common method of data transmission between webpages, each with a thousand autumn. Where the URL mode and the form implementation method simply, the simple data transfer between the webpage can be realized, which is generally a string type, which is characterized by poor security, and must be a continuous access to data delivery. Cookies can only store data of String types, and if you want to store more complex data types, you must first convert it to String type. Application objects and session objects are relatively complex, and the page should be appropriate when using very large webpages, and use the end of the same as possible to clear, otherwise it is possible to cause the server to be paralyzed. The session variable is high, and the private browsing end data can be delivered. The specific application determines the selection of data transfer mode, reasonable data transfer mode is the key consideration in the design of the web page.

转载请注明原文地址:https://www.9cbs.com/read-84066.html

New Post(0)