public static void SetConnectionString(string Conn) { HttpCookie aCookie = new HttpCookie("DCS"); aCookie.Value = AESStringCrypto.Encrypt(Conn, passPhrase); aCookie.Expires = DateTime.Now.AddYears(1); aCookie.Domain = "localhost"; aCookie.Secure = true; aCookie.HttpOnly = false; System.Web.HttpContext.Current.Response.Cookies.Add(aCookie); }
public static void SetUserPreferences(int SId, int DId) { HttpCookie aCookie = new HttpCookie("UserPref"); aCookie.Values["SId"] = AESStringCrypto.Encrypt(SId.ToString(), passPhrase); aCookie.Values["DId"] = AESStringCrypto.Encrypt(DId.ToString(), passPhrase); aCookie.Expires = DateTime.Now.AddYears(1); aCookie.Domain = "localhost"; aCookie.Secure = true; aCookie.HttpOnly = false; System.Web.HttpContext.Current.Response.Cookies.Add(aCookie); }
public static UserPreferences GetUserPreferences() { if (System.Web.HttpContext.Current.Request.Cookies["UserPref"] != null) { var Cookie = System.Web.HttpContext.Current.Request.Cookies["UserPref"].Values; UserPreferences upObj = new UserPreferences(); upObj.SiteId = Convert.ToInt32(AESStringCrypto.Decrypt(Cookie["SId"], passPhrase)); upObj.DivisionId = Convert.ToInt32(AESStringCrypto.Decrypt(Cookie["DId"], passPhrase)); return(upObj); } else { return(null); } }
public static string GetConnectionString() { if (System.Web.HttpContext.Current.Request.Cookies["DCS"] != null) { string Ct = (string)System.Web.HttpContext.Current.Request.Cookies["DCS"].Value; string Pt = AESStringCrypto.Decrypt(Ct, passPhrase); return(Pt); } else { return(string.Empty); } }