title: How to use session management with Load Balancer in Asp.Net
body: <p>I have four different server and a load balancer. I want to use captcha control. I did something with it this way:</p>
  
  <p>I created a handler.ashx to create the captcha image. This handler is used in the Main page. I keep the captcha control password in session while creating the captcha control. Then I compared password typed by the user with the password in the session. It works very well, but only on one server. </p>
  
  <p>It doesn't run correctly with four servers. Although the user enters the correct password every time, it sometimes matches with the session password and sometimes doesn't match. I think the problem reason is this:</p>
  
  <p>For Example :</p>
  
  <p>A,B,C and D are the four servers.  The load balancer routes the first request to A server. Which opens the main page from A server and creates password '123456'.  This is stored in session on A server.  Then user typed in the password and clicked button.  Now the load balancer routes this request to the B server.  Because session in B Sever is null, the passwords don't match. </p>
  
  <p>My web.config has this,</p>
  
  <pre><code>&lt;sessionState mode="StateServer" stateConnectionString="tcpip=127.0.0.1:42424"/&gt;
  </code></pre>
  
  <p>But It still doesnt work.</p>
  
  <p>What should I do ? </p>