public Identity(User user) { this.user = user; }
/// <summary> /// Initializes a new instance of the <see cref="WebSystemContext"/> class. /// </summary> public WebSystemContext() { Principal = new Principal(user = LoadUser()); }
private void SaveUser(User user) { var context = GetContext(); if (user != null) { var key = Guid.NewGuid().ToString(); context.Response.Cookies.Add(new HttpCookie(SESSION_KEY, key)); context.Cache.Add( key, user, null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, null); } else { var cookie = context.Request.Cookies[SESSION_KEY]; if (cookie != null) { context.Cache.Remove(cookie.Value); } } }
public Principal(User user) { identity = new Identity(user); }