title: Forms authentication in asp.net web forms and MVC
body: <p>I am trying to rebuild existing asp.net web forms and create a new mvc app. I am stuck on authenticating users. </p>
  
  <p>In web forms app I was using</p>
  
  <pre><code>public class UserPrincipal : System.Security.Principal.IPrincipal
  public class UserIdentity : System.Security.Principal.IIdentity
  </code></pre>
  
  <p>to declare custom UserPrincipal and UserIdentity classes.</p>
  
  <p>During login process I was using</p>
  
  <pre><code>UserPrincipal mpUser = new UserPrincipal(userID);
  if (mpUser != null)
                  {
                      Context.User = mpUser;
  FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1,
                          userID.ToString(),
                          DateTime.Now,
                          DateTime.Now.AddMinutes(60),
                          false,
                         ((UserIdentity)Context.User.Identity).IdentityRolesToString(userID)
                          );
  
  string encTicket = FormsAuthentication.Encrypt(authTicket);
  HttpCookie faCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
  Response.Cookies.Add(faCookie);
  </code></pre>
  
  <p>Is authentication process still the same. I found a lot of stuff about SimpleMembership, Basic Membership, ASP.NET Membership, but I am confused is this technique obsolete or there is a new recommended way to do this?</p>