title: Unable to get the Current.User.Identity using formsauthentication
body: <p>I am new to asp.net mvc 2. I'm learning mvc by doing a test project.
  I am using formsauthentication to log into my website. During login I am able to log into the website but I am not getting the useridentity.</p>
  
  <p>i have taken <a href="http://www.dotnetfunda.com/articles/article141.aspx" rel="nofollow">http://www.dotnetfunda.com/articles/article141.aspx</a> as my reference website</p>
  
  <p>in my webconfig file.</p>
  
  <pre><code>&lt;authentication mode="Forms"&gt;
        &lt;forms loginUrl="~/Home/login" defaultUrl="~/Home/login" cookieless="UseCookies" slidingExpiration="true" timeout="20" /&gt;
  &lt;/authentication&gt;
  </code></pre>
  
  <p>in login controller</p>
  
  <pre><code>public ActionResult Login(LogOnModel logon)
  {
      if (ModelState.IsValid)
      {
          if (FormsService.SignIn(logon.UserName, logon.Password) == true)
          {
              FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, // version 
                                                      FormsService.Username, // user name
                                                      DateTime.Now, // create time
                                                      DateTime.Now.AddSeconds(30), // expire time
                                                      false, // persistent
                                                      FormsService.Role,
                                                      FormsAuthentication.FormsCookiePath); // user data, such as roles
  
              string hashCookies =   FormsAuthentication.Encrypt(ticket);
              HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, hashCookies);
              Response.Cookies.Add(cookie);
              if (FormsService.Role == "Brand")
              {
                  return RedirectToAction("Index", "Creative");
              }
              else if (FormsService.Role == "Creative")
              {
                  return RedirectToAction("Index", "Creative");
              }
          }
      }
  
      return View();
  }
  </code></pre>
  
  <p>in userlogoncontrol i have made changes like this.
  but it is not displaying username and my bin.</p>
  
  <pre><code>&lt;%
      if (HttpContext.Current.User.Identity.IsAuthenticated)
      {
  %&gt;
          Welcome &lt;b&gt;&lt;%= Html.Encode(Page.User.Identity.Name) %&gt;&lt;/b&gt;!
          [ &lt;%= Html.ActionLink("Log Off", "LogOff", "Account") %&gt; ] |
  
  &lt;%
          if(HttpContext.Current.User.IsInRole("Brand"))
          {
  %&gt;
          [ &lt;%= Html.ActionLink("my bin", "Bin", "Brand") %&gt; ] |
  &lt;%
          }
          else if (HttpContext.Current.User.IsInRole("Creative"))
          {
  %&gt;
           [ &lt;%= Html.ActionLink("my bin", "Bin", "Creative") %&gt; ] |
  &lt;%
          }
      }
      else 
      {
  %&gt; 
          [ &lt;%= Html.ActionLink("Log On", "LogOn", "Account") %&gt; ]
  &lt;%
      }
  %&gt;
  </code></pre>
  
  <p>Did I miss anything?How can i save my user details like userid and role in cookie.</p>