Beispiel #1
0
        public static bool SetConfigSession(DataTable dtVals, DataTable dtNulls, clsDB DB)
        {
            int i = 0;

            if (dtNulls != null)
            {
                for (i = 0; i < dtNulls.Rows.Count; i++)
                {
                    try
                    {
                        HttpContext.Current.Session[lib.cStr(dtNulls.Rows[i]["KeyName"])] = System.Configuration.ConfigurationManager.AppSettings[lib.cStr(dtNulls.Rows[i]["KeyName"])].ToString();
                        DB.executeSQL("Update [config].[appSettings] SET KeyValue='" + (System.Configuration.ConfigurationManager.AppSettings[lib.cStr(dtNulls.Rows[i]["KeyName"])]) + "' WHERE KeyName='" + lib.cStr(dtNulls.Rows[i]["KeyName"]) + "'");
                    }
                    catch
                    {
                        return(false);
                    }
                }
            }
            for (i = 0; i < dtVals.Rows.Count; i++)
            {
                HttpContext.Current.Session[lib.cStr(dtVals.Rows[i]["KeyName"])] = lib.cStr(dtVals.Rows[i]["KeyValue"]);
            }

            return(true);
        }
Beispiel #2
0
        public void clear()
        {
            try {
                clsDB DB = new clsDB();
                DB.executeSQL("UPDATE tblUserSession SET SessionEnd = GETDATE() WHERE SessionEnd IS NULL AND User_PK=" + User_PK);
            }
            catch { }
            HttpContext.Current.Session.Clear();
            var sessionCookie = new HttpCookie("Advance_SessionID", lib.CompressString(HttpContext.Current.Session.SessionID));

            sessionCookie.Domain   = config.PortalURL();
            sessionCookie.HttpOnly = true;
            HttpContext.Current.Response.SetCookie(sessionCookie);
        }