Recommended: How ASP prevents repeated submissions of forms Users often encounter some unexpected situations when submitting forms, such as refreshing the page multiple times, pressing the back key, etc. If control measures are not taken, it will cause the problem of repeated submission of the form. The prevention method introduced in this article is mainly composed of four subroutines. In relatively simple applications, you just need to place these codes in the included file and directly reference them; for those
Anyone who uses ASP knows that a Session object stores the information needed for a specific user session, and when a user jumps between pages of the application, variables stored in the Session object are not cleared, and these variables are always present when the user accesses the page in the application. It can reduce the complexity of the program and improve programming efficiency, but it also has many shortcomings, which is explained in this article.
1. Advantages
If you want to pass a variable between many web pages, then using a Session variable is simplified by passing a variable through QueryString.
To make the WEb site user-friendly, consider using the Session variable. Every visitor to your site has experience in userization. Based on this, with the use of LDAP and MSSiteServer, it is no longer necessary to put all userization processes into session variables, and this userization depends on user preferences.
You can use the session variable directly whenever you want to use it without having to declare it in advance, which is close to the use of variables in VB. After use, you don't have to consider releasing it, as it will be automatically released.
2. Disadvantages
Session variables and cookies are of the same type. If a user sets his browser to be incompatible with any cookies, then the user cannot use this Session variable!
When a user visits a page, the running environment of each Session variable is automatically generated, and these Session variables can be retained for 20 minutes after the user leaves the page! (In fact, these variables can always be kept to timeout. The length of timeout is set by the web server administrator. Some sites only last for 3 minutes, some for 10 minutes, and some for 20 minutes.) So if you put larger objects in the Session (such as ADOrecordsets, connections, etc.), then you will be in trouble! As the number of site visits increases, the server will not be able to operate normally!
Because creating Session variables is very arbitrary and can be called at any time and does not require precise processing by developers, excessive use of session variables will make the code unreadable and difficult to maintain.
Although you can use the session variable directly whenever you want to use it without having to declare it in advance, this approach is close to the use of variables in VB. After use, you don't have to consider releasing it, as it will be automatically released. But who thought of it there? What does a variable mean? None of these becomes very clear.
Summarize
Using Session variables has both advantages and disadvantages. As far as this article is concerned, it is best to use less, but using them in some places can greatly simplify web development, so whether to use Session depends on the needs of the project, but whether it is used or not, its advantages and disadvantages must be considered in advance.
Share: How to solve the problem of left intercepting character titles with different lengths We often see that when we use left to cut strings, because Chinese characters and English coexist in the title, the two news titles are different in length. In order to solve this problem, we can use the following function. % '****************************************** 'Function name: gotTopic 'Function: cut off string, one Chinese character is calculated