SESSION management in a load balancing environment

Source: Internet
Author: User
Tags http cookie session id sessions
One of the biggest challenges when creating an interactive web page is to maintain the user's status, A website may want to remember who you are, what you clicked before Page n, what you did last time, and what you want to display to you now. There are many ways to implement these functions, such as querying strings, submitting forms, or cookies. The most powerful one is ASP Session objects.
 
Http://www.asptoday.com/articles/20000118.htm when the user first arrives at a site, he/she is given an HTTP cookie format SessionID (is a read-only attribute,
Returns the session id for each user ). Then, the server can track a group of variables in the session collection
Matches session cookies to ensure that each user has a specific variable. As long as the user remains active on the server,
The session variable maintains its state. The default validity period of a session variable is 20 minutes.
In the browser, the global. asa file runs no matter what the session_OnEnd part is.
The key to the above statement is "remain active on the server ". Each session variable is set on the network server and kept in
Local memory. So what if you use load balancing in a web scope? (For more information about server load balancer, see
Msdn article 'asp and Web Session management '). For real load balancing
When a user clicks a connection, it changes the status of the server, and may lose their
Session information.
If you find that you are writing code in this environment-or you suspect that your site is eventually load balancing-you have four methods
To solve this problem.
○ No session is used at all.
○ Use temporary cookies.
○ Purchase a third-party component to handle session management.
○ Load balancing is performed only for the first click within the web range.
This article will discuss these four options and explain when and where they are most applicable.
Sessions is not used at all.
Obviously, one way to solve sessions management is to not use the sessions variable at all. But you are still stuck in
Status persistence. You can use the simplest method to track users without writing to the client.
An insecure method is to use a browser to query strings or use hidden values for form placement to keep users active.

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.