How to verify SessionProvider is working

Jul 19, 2009 at 7:26 PM

I am setting up a web farm environment and am trying to verify that the MemCached Session Provider is working.  I have 2 servers set up and load balanced.  I put code on each server to show which server I'm on, so I can test whether session state carries between the two.

On Server1, I added this in the default.aspx file:

<%Session('test") = "test" %>

<%=Session('test")  %>

On Server2, I added the following:

<%=Session('test") %>

As long as i hit server1 first, the Session("test") variable should be written out when I hit server2 if the session state is being stored, right?

A couple of questions-

1. That is the correct behavior to expect?

2. How can I verify that this is working and dig into why it doesn't seem to work from server to server?  Is there an easy way to find the record in memcached?  I can verify that objects exist in memcached by telnetting in, but that does me no good because we use it for object caching.



Jul 20, 2009 at 5:49 PM

1. Yes

2. You switch off the Db backup and see if session are working. One more thing if you are accessing the page with two different browsers by
typing http://s01/default.aspx in one browser instance and http://s02/default.aspx in the other then it will not work. Because both will be considered 
as different browser sessions. To do this, access should be through a load balancer and using something like this http://loadBalancer/default.aspx.
You can set the load balancer to serve pages in a round robin manner. This way each request is sent to different server hence confirming the behaviour.

Hope this helps,



Jul 20, 2009 at 5:54 PM

Database backups are disabled and I am accessing the page by refreshing the browser window (and checking for SERVER1 or SERVER2, text that I included in the page code to verify which server I'm hitting).  The session variable simply doesn't show up on the second server. 

Any suggestions for additional troubleshooting?

Jul 21, 2009 at 5:10 PM

can you post both of the config files here.
- Fahad