title: Magento isLoggedIn return false after an ajax load
body: <p>After loading a new block with the help of Ajax, the new block does not keep the customer logged in.</p>
  
  <p>This is the code currently used in my <code>.phtml</code> loaded by Ajax:</p>
  
  <pre><code>require_once Mage::getBaseDir('app'). '/Mage.php';
  umask(0);
  Mage::app('');
  Mage::app(Mage::app()-&gt;getWebsite()-&gt;getId(), 'website');
  
  Mage::getSingleton('core/session', array('name'=&gt;'frontend'));
  $session = Mage::getSingleton('customer/session', array('name'=&gt;'frontend'));
  if($session-&gt;isLoggedIn()){
      echo "in";
  }else{
      echo "out";
  }
  </code></pre>
  
  <p>This is how the new block is loaded (in my controller):</p>
  
  <pre><code>$this-&gt;loadLayout();
  echo $this-&gt;getLayout()-&gt;getBlock($blockToLoad)-&gt;toHtml();
  </code></pre>
  
  <p><strong>EDIT: The session is already lost before the load of the block.</strong></p>
  
  <p>What confuses me is that I can save and load variables without any problem.
  This mean that Mage is actually using the same session instance.</p>
  
  <p>The following line work perfectly in my <code>.phtml</code> loaded by Ajax:</p>
  
  <pre><code>Mage::getSingleton('customer/session')-&gt;getYourVariable();
  </code></pre>
  
  <p>So what could cause the session customer to log out after an Ajax call and how can I fix that?</p>
  
  <p>Thanks.</p>