Ejemplo n.º 1
0
        public static void UpdateLogoff(this HttpSessionStateBase session, int portalId, int clientId)
        {
            User user = (User)session["UserSession_" + portalId.ToString()];
            int userid = user.UserId;
            string ipv4Address = "";
            var connectionStrings = new SqlNativeConnectionStrings(HttpContext.Current.Application["KBInstallPath"].ToString());
            var datRepo = new DataConfigurationRepository(HttpContext.Current.Application["KBDataPath"].ToString(), HttpContext.Current.Application["KBInstallPath"].ToString());
            SqlServerPortalLogRepository portalLogRep = new SqlServerPortalLogRepository(connectionStrings, datRepo);
            if (HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != null)
            {
                ipv4Address = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString().Split(new char[] { ',' }).FirstOrDefault();
            }
            if (ipv4Address == "")
            {
                ipv4Address = HttpContext.Current.Request.UserHostAddress;
            }

            portalLogRep.Logoff(portalId, clientId, userid, HttpContext.Current.Session.SessionID, ipv4Address);
        }
Ejemplo n.º 2
0
        public static void LogPortalVisit(int userid, int portalId, int clientId, int newlog, string url)
        {
            string ipv4Address = "";

            var connectionStrings = new SqlNativeConnectionStrings(HttpContext.Current.Application["KBInstallPath"].ToString());
            var datRepo = new DataConfigurationRepository(HttpContext.Current.Application["KBDataPath"].ToString(), HttpContext.Current.Application["KBInstallPath"].ToString());
            SqlServerPortalLogRepository portalLogRep = new SqlServerPortalLogRepository(connectionStrings, datRepo);
            if (HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"] != null)
            {
                ipv4Address = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].ToString().Split(new char[] { ',' }).FirstOrDefault();
            }
            if (ipv4Address == "")
            {
                ipv4Address = HttpContext.Current.Request.UserHostAddress;
            }
            portalLogRep.PortalVisitAsync(portalId, clientId, userid, HttpContext.Current.Session.SessionID, ipv4Address, newlog, url);
        }