Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


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

Posted on 2004-09-30
Medium Priority
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 1000 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 1000 total points
ID: 12188807

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

609 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