Click here to Skip to main content
15,898,222 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
suppose i have a senario like i have deployed my asp.net application in multiple web servers due to balance the load. because if one server gets loaded the load balancer will passes the request to another web server there by client will be happy

in this senario say for ex: client requests page1.aspx for web server1 after that client request for page2.aspx but web server1 gets loaded so load balancer passes the request to another web server2 and serve the request

in this senario i choosed session variables. may i know how to get session variable value from one web server to another webserver? if its not possible can u guide me which is best way of passing values between pages
Posted

I am not Completely understood your requirement, But i think your are looking for a load balancing for your web application. There are Hardware/Software available for the load balancing, Google it.

Here is the link for you about the WebGarden, please refer this.
http://iisadmins.blogspot.com/2011/04/difference-between-web-farm-and-web.html[^]

Thanks
--RA
 
Share this answer
 
I think you should use Session (Session-StateServer or Session-SQLServer) for web application is hosted in WebGarden or webfarm . or any other Client side State management like cookies.
C#
Configuration: For StateServer
<sessionstate>
    mode="InProc"
    stateConnectionString="tcpip=127.0.0.1:42424"
    sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
    cookieless="false" 
    timeout="20" /> </sessionstate>

C#
Configuration: SQL Server
<sessionstate mode="SQLServer" sqlconnectionstring="..." /> 


For reference
Beginners Introduction to State Management Techniques in ASP.NET[^]
ASP.NET Session Management Internals[^]

Thanks
Akash Detroja
 
Share this answer
 
v2
Comments
Rahul Rajat Singh 8-Jun-12 6:01am    
I think he understands the state management techniques. he is having some problems in web farm scerio in maintaining the sessions. but your code snippet perfectly defines how to setup session server in outproc mode.
1. If you are using inproc session (when session info is in web servers memory) [THIS IS THE DEFAULT]

You will have to use a load balance that support connection affinity to sticky sessions. so that the load balancer will always forward request from a client to same server.

2. if you are using outporc session i.e. sqlserver or stateserver for session management.

This will take care of everything just fine. you will be needing a separate server and explicit configuration to do this. also you need to make sure that all the values you are putting in session are all serializable.

But i am guessing you are using the first way. so i suggest, check your load balancer to use connection affinity to sticky sessions. that is the only rescue. and what you asked for in the first place is not possible for inproc/default way of session handling.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900