title: FormsAuthenticationTicket isn't storing UserData
body: <p>I'm relatively new to .NET and am trying to figure out FormsAuthentication. I've gone through a few different tutorials and every time I hit the same problem.  For some reason the UserData isn't being stored in the ticket.  When I setup a break on the ticket in the Global.aspx.cs the UserName is there but the UserData is an empty string and the Version is set to 2 when it is specified as 1. Another odd thing is that every authenticated user is allowed to access the pages in my Admin_Content folder when the web.config specifies that only Administrators can.</p>
  
  <p>Login.aspx</p>
  
  <pre><code>UserFull user = ManageUsers.login(loginTemplate.UserName, loginTemplate.Password);
  if (user != null)
  {
      string[] roles = { user.role };
  
      FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(
          1,
          userName,
          DateTime.Now,
          DateTime.Now.AddDays(30),
          true,
          roles[0],
          FormsAuthentication.FormsCookiePath
      );
  
      string encryptedTicket = FormsAuthentication.Encrypt(authTicket);
      FormsAuthentication.SetAuthCookie(encryptedTicket, true);
  
      Response.Redirect("Admin_Content/Admin.aspx");
   }
  </code></pre>
  
  <p>Global.aspx.cs Application_AuthenticateRequest</p>
  
  <pre><code>if (HttpContext.Current.User != null)
  {
      if (HttpContext.Current.User.Identity.IsAuthenticated)
      {
          if (HttpContext.Current.User.Identity is FormsIdentity)
          {
              FormsIdentity id = (FormsIdentity)HttpContext.Current.User.Identity;
              FormsAuthenticationTicket ticket = (id.Ticket);
              if (!string.IsNullOrEmpty(ticket.UserData))
              {
                  string userData = ticket.UserData;
                  string[] roles = userData.Split(',');
                  HttpContext.Current.User = new System.Security.Principal.GenericPrincipal(id, roles);
              }
          }
      }
  }
  </code></pre>
  
  <p>Main web.config</p>
  
  <pre><code>&lt;configuration&gt;
  &lt;system.web&gt;
    &lt;compilation debug="true" targetFramework="4.0" /&gt;
    &lt;roleManager enabled="true"&gt;&lt;/roleManager&gt;
    &lt;authentication mode="Forms"&gt;
      &lt;forms name="AOTMP_Demo" loginUrl="Login.aspx"
      protection="All" path="/" cookieless="UseCookies"/&gt;
    &lt;/authentication&gt;
    &lt;authorization&gt;
      &lt;allow users="*"/&gt;
    &lt;/authorization&gt;
  &lt;/system.web&gt;
  &lt;configuration&gt;
  </code></pre>
  
  <p>Admin_Content folder's web.config</p>
  
  <pre><code>&lt;configuration&gt;  
    &lt;system.web&gt;
      &lt;authorization&gt;
        &lt;allow roles="Administrator"/&gt;
        &lt;deny users="?"/&gt;
      &lt;/authorization&gt;
    &lt;/system.web&gt;
  &lt;/configuration&gt;
  </code></pre>