Ejemplo n.º 1
0
        public IActionResult Index()
        {
            var ip          = _accessor.HttpContext.Connection.RemoteIpAddress.ToString();
            var userAgent   = Request.Headers["User-Agent"];
            var browserInfo = "";

            if (userAgent.Any())
            {
                browserInfo = userAgent.First();
                if (browserInfo.Length > 50)
                {
                    browserInfo = browserInfo.Substring(0, 50);
                }
            }

            _visitorService.SaveVisitor(ip, browserInfo);

            //test();

            return(View());
        }