public void Add(string message, NotificationType type) { HttpCookie notificationClientCookie = HttpContext.Current.Request.Cookies.Get(guidCookieName); Guid clientGuid = new Guid(notificationClientCookie.Value); if (!NotificationStore.ContainsKey(clientGuid)) { NotificationStore[clientGuid] = new TimedList <Notification>(); } NotificationStore[clientGuid].Add(new Notification(message, type)); }
public string GetContent(ClientState state) { Guid clientGuid = new Guid(state.ClientGuid); if (!NotificationStore.ContainsKey(clientGuid)) { return(""); } string result = new JavaScriptSerializer().Serialize(NotificationStore[clientGuid]); NotificationStore[clientGuid].Clear(); return(result); }