title: FormsAuthentication: UserData lost (but in Cookie)
body: <ul>
  <li>Asp.Net MVC 3</li>
  <li>FormsAuthentication (custom)</li>
  <li>iPad MobileSafari</li>
  <li>iframe (same domain)</li>
  </ul>
  
  <p>After struggling with <code>formsTicket.UserData</code> not working with <strong>MobileSafari</strong> (ONLY MoblieSafari), I found out, that <code>httpContext.User.Identity.Ticket.UserData</code> is <strong>empty</strong> (in MobileSafari, not the others) and the original FormsAuthentication <strong>HttpCookie</strong> contains the <strong>right values</strong>?!?</p>
  
  <p>How can that be?!</p>
  
  <p>Code:</p>
  
  
  
  <pre class="lang-cs prettyprint-override"><code>public void UpdateContext()
  {
      if (httpContext.User.Identity is FormsIdentity)
      {
          // Get Forms Identity From Current User
          FormsIdentity id = (FormsIdentity)httpContext.User.Identity;
          // Create a custom Principal Instance and assign to Current User (with caching)
          HttpCookie cookie = HttpContext.Current.Request.Cookies.Get(FormsAuthentication.FormsCookieName);
          FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(cookie.Value);
  
          var cookieUserData = ticket.UserData; // not empty
          var httpContextIdentiyUserData = id.Ticket.UserData; // empty!
          ...
      }
  }
  </code></pre>
  
  <p>Any clue would be helpful!</p>
  
  <p>Lg<br>
  Warappa</p>
  
  <p>PS: If it matters, I use a page of my website in an iframe - same domain.</p>