How can I solve the problem of ASP Session management in Load Balance?

Please any Experts help me to solve the problem of ASP Sesson in Load Balance.
I have developed a Web System by ASP+COM and have user login management in system.
After User login , I have used a lot of session to store the variable (include Key value) .
Now I have encountered one problem , we have to setup two or three server to load balance the system loading.  But after Session stored , it will be in one server's memory . Another page request of the same user get in system, load balance will maybe redirect the page to another server . The Session Fail to maintain and Function fail to work.

Experts have any suggestion?

ps. We have try to maintain the session in load Balance like Local Director , it will set the same session always be in the same server(Maintain by IP) . But this is a bad idea . Cause a lot of user pass through ISP( have the same IP ) . Then a lot of people be affected by one person logout. <:~
Who is Participating?
cristy56Connect With a Mentor Commented:
Session state can be easily stored on a different machine.

Original ASP always stored session state on the server machine on which it was created. This architecture didn’t scale well to a Web farm in which every request is potentially handled by a different server. ASP.NET allows each application to specify the machine on which it wants its session state to be stored. You do this by setting the stateConnectionString attribute in the web.config file. In this way, any machine that handles a subsequent call can access the session state stored by a previous call handled by a different machine. Obviously, you now incur the overhead of another network round-trip, so maybe you’d rather set up your load balancer to route subsequent requests to the same machine. You can swap out that machine by simply changing its name in the configuration files of all the clients.

You can also store session state in a SQL Server database.

You can also store session state in SQL Server for better management of large collections. You do this by setting the mode attribute to sqlserver and providing a SQL connection string in the sqlConnectionString attribute. The current setup scripts create a temporary database for holding session state. This provides fast access because the data isn’t written to the slow iron disk, but it also means that the session state won’t survive a crash. If you want that durability and don’t mind paying the performance penalty for it, you can change the database attributes yourself to use a permanent table.

ASP.NET also provides another state collection for data at an application level.

ASP.NET also helps you manage application state, where an application represents a top-level IIS virtual directory and all of its subdirectories. Application-level state is stuff that changes from time to time, so you don’t want to hard code it, but it applies to all users of the application and isn’t tied to an individual user. An example of application state might be the current unadvertised special offer that every page would display. Each application contains one state object named Application, similar in use to the Session object, except that all accesses of the Application object operate on the same data regardless of the user on the other end.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.