MuruganAD.com
Murugan Andezuthu Dharmaratnam

  |  HOME   |  BLOG   |  DISCUSSION FORUM   |  ARTICLES   |  8086  |  C++   |  VC++   |  ASP .NET   |  VB .NET   |  JAVA SCRIPT   |  MS SQL   |  MY   |  VIDEOS   |  DOWNLOADS   |  CONTACT ME   |  



Session State value Lost When Page is Redirected.

Home    ASP .NET    IXWebhosting Session Lost


Have this problem of session value being lost on Ix webserver as IX Web server is configured 
as a webfarm and pages are rendred back from different servers. With ix since its a webfarm 
what happens is when u upload a page say xyz.aspx its mirror copies are stored in different 
server. and load balancing returns the server with minimal load when the page is requested.

When u use a session variable like 
Session("abc") = 10 
with default configuration in web.config

The default configuration is inproc.
Inproc means the Session() variable is stored in the memory of the server. 
But values stored in the memory are not available on all the servers in the webfarm. 
so the session value is lost. 

Solutions are storing sessionstate in sqlserver or in stateserver
sqlserver is not possible with ixwebhosting unless u specify an external sqlserver. 
Here's an article on how to store session state in a database - 
http://muruganad.com/ASP.NET/ASP_NET_Howto_Store_Session_In_Database_WebFram.html

The Solution for Ixwebhosting users is to just add this in the web.config. 

To prevent any problems with sessions during using asp.net please use session mode
 "StateServer" in place of inproc or sql server mode. 
To enable this session mode you should put following code inside your 
web.config file:
<configuration>
<system.web>
<sessionState mode="StateServer"
stateConnectionString="tcpip=127.0.0.1:42424"
cookieless="false"
timeout="20"/>
</system.web>
</configuration>




  |  HOME   |  BLOG   |  DISCUSSION FORUM   |  ARTICLES   |  8086  |  C++   |  VC++   |  ASP .NET   |  VB .NET   |  JAVA SCRIPT   |  MS SQL   |  MY   |  VIDEOS   |  DOWNLOADS   |  CONTACT ME   |  

Copyright 2009 @ Murugan Andezuthu Dharmaratnam