Exemple #1
0
        public static void IncreaseCounter()
        {
            try
            {
                string ip = IpAddress();
                if (IsValidIP(ip))
                {
                    HttpCookie cookie = HttpContext.Current.Request.Cookies["Shakaeak_svc"];
                    if (cookie == null)
                    {
                        IpCountryService ips = new IpCountryService();

                        IpEntity ipe = ips.GetIpInfo(ip, GetKey());
                        if (ipe != null)
                        {
                            vc_Create(ipe.CTRY);
                            cookie         = new HttpCookie("Shakaeak_svc");
                            cookie.Expires = DateTime.Now.AddHours(1);

                            HttpContext.Current.Response.Cookies.Add(cookie);
                        }
                    }
                }
            }
            catch
            {
            }
        }
Exemple #2
0
        public static void DecreaseCounter()
        {
            string ip = IpAddress();

            if (IsValidIP(ip))
            {
                //HttpCookie cookie = HttpContext.Current.Request.Cookies["Tawfik_svc"];
                //if (cookie == null)
                //{
                IpCountryService ips = new IpCountryService();

                IpEntity ipe = ips.GetIpInfo(ip, GetKey());
                if (ipe != null)
                {
                    vc_Delete(ipe.CTRY);
                    //cookie = new HttpCookie("Tawfik_svc");
                    //cookie.Expires = DateTime.Now.AddHours(1);

                    //HttpContext.Current.Response.Cookies.Add(cookie);
                }

                //}
            }
        }