In order to support History
SecurityToken tk =
null;
string
url = HttpContext.Current.Request.Url.Scheme +
"://" + HttpContext.Current.Request.Url.Authority;
//Create claims based authentication token
tk = SPSecurityContext.SecurityTokenForFormsAuthentication(new
Uri(url), membershipProvider, roleProvider, strUsername, String.Empty);
if
(tk != null)
{
SPFederationAuthenticationModule fam = SPFederationAuthenticationModule.Current;
fam.SetPrincipalAndWriteSessionToken(tk);
}
You can read these articles for custom membership provider or role provider and FBA configuration.