473,698 Members | 2,643 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Session variable scope in a Load Balanced environment

I have the following scenario in a true load balanced environment (without
sticky sessions):

There are 2 ASPX pages. I want to pass an object from the first page to the
second page. On the btnContinue_Cli ck event of Page1.aspx, I create the
object and store it in a session variable. The next statement would be
Response.Redire ct("Page2.aspx" ). The code appears like this:
private void btnContinue_Cli ck(object sender, EventArgs e)
{
OrderInfo orderInfo = new OrderInfo();
orderInfo.Prope rty1 = "Property1" ;
orderInfo.Prope rty2 = "Property2" Session["orderInfo"] =
orderInfo;
Response.Redire ct("Page2.aspx" );
}On Page2.aspx, on the Page_Load event, I retrieve the object from the
Session variable and put it in a OrderInfo object and then remove the
session variable. The code looks similar to below:
void Page_Load(objec t sender, EventArgs e)
{
OrderInfo orderInfo = new OrderInfo();
orderInfo = (OrderInfo)Sess ion["orderInfo"];
Session.Remove( "orderInfo" );
}My understanding is - creating the object, putting it in a Session
variable, redirecting to another page and retrieval of the object in the
second page - all these happens in one server call. I don't care if the
Session variable is lost after this call. That is the reason I remove the
variable from session state.

My question is - are there any chances that the Session variable will lose
its value in the above scenario because of load balancing?

Any help will be appriciated.

Thanks!

Dec 28 '05 #1
1 3534
On Wed, 28 Dec 2005 11:57:17 +0530, Vidyadhar Joshi wrote:
I have the following scenario in a true load balanced environment (without
sticky sessions):

There are 2 ASPX pages. I want to pass an object from the first page to the
second page. On the btnContinue_Cli ck event of Page1.aspx, I create the
object and store it in a session variable. The next statement would be
Response.Redire ct("Page2.aspx" ). The code appears like this:
private void btnContinue_Cli ck(object sender, EventArgs e)
{
OrderInfo orderInfo = new OrderInfo();
orderInfo.Prope rty1 = "Property1" ;
orderInfo.Prope rty2 = "Property2" Session["orderInfo"] =
orderInfo;
Response.Redire ct("Page2.aspx" );
}On Page2.aspx, on the Page_Load event, I retrieve the object from the
Session variable and put it in a OrderInfo object and then remove the
session variable. The code looks similar to below:
void Page_Load(objec t sender, EventArgs e)
{
OrderInfo orderInfo = new OrderInfo();
orderInfo = (OrderInfo)Sess ion["orderInfo"];
Session.Remove( "orderInfo" );
}My understanding is - creating the object, putting it in a Session
variable, redirecting to another page and retrieval of the object in the
second page - all these happens in one server call. I don't care if the
Session variable is lost after this call. That is the reason I remove the
variable from session state.

My question is - are there any chances that the Session variable will lose
its value in the above scenario because of load balancing?

Any help will be appriciated.

Thanks!

In my experience, load balancing (without sticky), will create problems
for you.
You will also have problems with the Session being dumped due to timeout,
restarts of the server, etc.

Dec 28 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2722
by: gfuller | last post by:
- We have 2 aspx pages in a .NET project. The first sets a session variable and has a button that when clicked performs a 'redirect' to the second page which then reads the session variable. Problem: This always works fine on the localserver and through the IDE. But when the application is put onto a www website, the following occurs; - If you browse to the site using the IP address, session variables work fine
3
1487
by: Simon Niederberger | last post by:
How can I give a user-defined object session scope? From http://www.microsoft.com/windows2000/en/server/iis/default.asp?url=/windows2000/en/server/iis/htm/asp/iiwaobu.htm I gather that it can be done, but there are no examples. Simply setting Set Session("tag") = new MyClass doesn't work.
7
2036
by: Nicole | last post by:
Hi I'm trying to use a function to set a session variable. I have three files: The first file has: <?php session_start(); // This connects to the existing session ?> <html> <head>
4
1678
by: Dean | last post by:
I finally got class session variables to work by putting the following in global.asax in the session_start: dim myDBComp as DBComp = new DBComp........ session("myDBComp") = myDBComp In each aspx codebehind module I can define my object right after the class definition as so: dim myDBComp as DBComp The problem I had was where to put the instantiation:
4
4954
by: DeeAnn | last post by:
We've encountered a "flaky" situation with a Session variable holding a data set on load balanced servers; server session with cookies is set up. Background: Session variable holds a dataset. Dataset is retrieved and updated periodically. Eventually the dataset is sent to a web service for processing.
8
1722
by: Anthony P. Mancini | last post by:
I'm working on a proof of concept that will ultimately be deployed on a load balancer. For the sake of a preliminary demonstration I created a C# object and marked it's attributes as Public Shared Static. I also set the EnableSessions and EnableViewState Page directives to false. Here's the part that stumped me : as I was moving from page to page within the demo, I accidently realized the data I dropped
5
2007
by: Pross | last post by:
I've got an ASP.NET application and I need some information on every page like the user's name as well as a collection listing which sections of the application the user has access to. I could store the user name in a regular session variable but the collection varies in size based on the user and could grow in the future as the application grows. I don't want to keep going back to the database for this info every time because it's needed...
0
2108
by: SeanGallavan | last post by:
Our Environment: Two network load balanced (using Microsoft NLB software) webservers with session maintained in a SQL Server database. NLB is configured with no affinity settings and two network cards in each machine. Machine keys are identical on both webservers. There is no anti-virus software installed. SQL Server database is storing session information as specified by Microsoft guidelines.
4
9567
by: Abi | last post by:
We able to generate this error in our test environment and were able to research this enough to understand that the issue is NOT with an abject that needs to be serialized but rather as the stack trace suggests that the server (in the web farm) ran out of memory while attempting to stream data to an ASP Session State database (SQL Server 2000) . Our test environment consists of: - 3 web servers Load Balanced - SQL Server 2000 Database...
0
8683
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8611
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9031
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8904
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8876
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6531
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.