/// <summary> /// Determines if a <see cref="System.Web.HttpCookie" /> that corresponds with <typeparamref name="TIHttpCookie"/> exists. /// </summary> /// <typeparam name="TIHttpCookie"></typeparam> /// <returns></returns> public bool CookieExists <TIHttpCookie>( ) where TIHttpCookie : class, IHttpCookieSerializable, new() { TIHttpCookie theObj = new TIHttpCookie( ); HttpCookie theCookie = CookieHelper.GetCookie(theObj.CookieName); return(theCookie != null); }
/// <summary> /// Loads and returns a <typeparamref name="TIHttpCookie"/> from a <see cref="HttpCookie" /> if one exists, otherwise returns null. /// </summary> /// <typeparam name="TIHttpCookie"></typeparam> /// <returns></returns> public TIHttpCookie LoadFromCookie <TIHttpCookie>( ) where TIHttpCookie : class, IHttpCookieSerializable, new() { TIHttpCookie theObj = new TIHttpCookie( ); HttpCookie theCookie = CookieHelper.GetCookie(theObj.CookieName); if (theCookie == null) { theObj = null; } else { theObj.FromCookie(theCookie); } return(theObj); }