ASP.NET Custom Pricipal and Cookies (tickets)
If i create a custom principal with five custom properties (example, phoneNumber), does the principal data get trasmitted inside of the cookie or does the data stay in the server?
void MvcApplication_AuthenticateRequest(object sender, EventArgs e)
{
if (HttpContext.Current.User != null)
{
if (HttpContext.Current.User.Identity.IsAuthenticated)
{
if (HttpContext.Current.User.Identity is FormsIdentity)
{
// Get Forms Identity From Current User
FormsIdentity id = (FormsIdentity)HttpContext.Current.User.Identity;
// Get Forms Ticket From Identity object
FormsAuthenticationTicket ticket = id.Ticket;
开发者_C百科 // Create a new Generic Principal Instance and assign to Current User
IFGPrincipal siteUser = new IFGPrincipal(Context.User.Identity, new string[] { }, 2);
HttpContext.Current.User = siteUser;
}
}
}
}
精彩评论