Exemple #1
0
        /// <summary>
        /// 记录用户访问日志
        /// </summary>
        protected void VisitLog()
        {
            //抛出localhost部分(当做分布式时需要将主机以及端口记录)
            ls_visit_log log = new ls_visit_log()
            {
                user_id       = GetUserInfo().id,
                user_name     = GetUserInfo().user_name,
                visit_time    = DateTime.Now,
                visit_url     = HttpContext.Current.Request.Url.ToString(),
                visit_ip      = Utils.GetIPAddress(),
                visit_browser = Utils.GetBrowser(),
                visit_os      = Utils.GetOSVersion()
            };
            MSMQHelper msmq = new MSMQHelper();
            string     msg  = JSONHelper.SerializeObject(log);

            LogHelper.SaveVisitToLog(msg);
            msmq.Send(msg);
        }