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

Posted on 2004-09-30
Last Modified: 2013-12-03
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. <:~
Question by:cowcowlin
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

cristy56 earned 250 total points
ID: 12187706
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.

LVL 31

Assisted Solution

alorentz earned 250 total points
ID: 12188807
LVL 31

Expert Comment

ID: 12188815

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
CDO.Message not able to send attachement 5 42
Time comparison asp 1 27
Use Mid in Html 6 33
Validating number not work with decimal 4 42
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question