title: Proper setup for load balanced web that needs sticky sessions?
body: <p>I have found many q&amp;a's on this subject, but I still haven't figured out the proper configuration for our servers. Background is this: We have two web servers behind a load balancer and must make sure that the user's don't loose their sessions. </p>
  
  <ul>
  <li>Web servers are IIS7/ASP.NET 4. </li>
  <li>We currently cannot setup a separate session state server and must therefor use sticky sessions on the LB.</li>
  </ul>
  
  <p>As far as I understand, the following must be assured:</p>
  
  <ul>
  <li>Set same machinekey on both web servers.</li>
  <li>Use precompiled sites so that the assemblies get the same naming on both machines.</li>
  <li>We either must base sticky session on ip-number or cookie (the latter is prefered)</li>
  </ul>
  
  <p>Is it necessary to have precompiled sites? (I know it is faster, but we loose some flexibility)</p>
  
  <p>Since we have sticky sessions, is it correct that having the same machinekey only affects those cases when user's session time out and he/she therefore ends up on the other server (which means a post back containing view state might not be valid unless they have the same machine key?)</p>