string mysql = "insert into cip (ipa,ipp,ipu,host,posttime,http,ips,ipsp,usersys,userbrowser) values ('" + Request.ServerVariables["Remote_Addr"] + "','" + Request.ServerVariables["REMOTE_PORT"] + "','" + Page.User + "','" + Request.ServerVariables["Remote_Host"] + "','" + DateTime.Now + "','" + "http://" + Request.ServerVariables["Http_Host"] + Request.ServerVariables["Path_Info"] + "','" + "IP" + "(内网:" + Request.ServerVariables["Local_Addr"] + ")" + "','" + Request.ServerVariables["Server_Port"] + "','" + Request.Browser.Platform + "-[16位:" + Request.Browser.Win16 + "]" + "[32位:" + Request.Browser.Win32 + "]" + "','" + Request.Browser.Browser + Request.Browser.Version + "')";================================================================= Label1.Text = "用户源IP地址:" + Request.ServerVariables["Remote_Addr"]; Label2.Text = "用户源端口号:" + Request.ServerVariables["REMOTE_PORT"]; Label3.Text = "用户源信息:" + Page.User; Label4.Text = "用户源机器名:" + Request.ServerVariables["Remote_Host"]; Label5.Text = "用户源访问时间:" + DateTime.Now; Label6.Text = "用户源访问地址:" + "http://" + Request.ServerVariables["Http_Host"] + Request.ServerVariables["Path_Info"]; Label7.Text = "用户源访问IP地址(内网):" + "IP" + "(内网:" + Request.ServerVariables["Local_Addr"] + ")"; Label8.Text = "用户源访问端口号:" + Request.ServerVariables["Server_Port"]; Label9.Text = "用户源操作系统:" + Request.Browser.Platform + "-[16位:" + Request.Browser.Win16 + "]" + "[32位:" + Request.Browser.Win32 + "]"; Label10.Text = "用户源浏览器:" + Request.Browser.Browser + Request.Browser.Version;
前几天写的来访用户端口号记录功能
于 2013-09-27 10:56:21 首次发布
本文介绍了一种使用 ASP.NET 技术记录用户访问信息的方法,并通过 SQL 语句将这些信息存储到 MySQL 数据库中。主要记录了用户的 IP 地址、端口、用户名、主机名、访问时间、访问 URL、内网 IP 地址、服务器端口、操作系统平台及浏览器类型等详细信息。
871

被折叠的 条评论
为什么被折叠?



