我想获得用户的IP和使用寿在table.I'm插入如下:得到用户的IP
SqlCommand cmd = new SqlCommand("INSERT INTO Raspunsuri Values(@raspuns,@cnp,@data,'1',@ip)", con);
cmd.Parameters.AddWithValue("@cnp", Session["sesiune_cnp"]);
cmd.Parameters.AddWithValue("@raspuns", textbox1.Text);
cmd.Parameters.AddWithValue("@data", DateTime.Now.ToLocalTime());
cmd.Parameters.AddWithValue("@ip", HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"]);
但是,当我在表中列一下IP I只得到1 ...你能给我一个解释吗?
可能重复的[客户端IP地址](http://stackoverflow.com/questions/3003242/client-ip-address) – 2012-01-30 09:05:53
Windows窗体? WCF?的WebForms? ... 什么? – balexandre 2012-01-30 09:06:10
您安装了IPv6,并且从同一台机器本地访问Web服务器,因此地址以“:: 1”形式出现? – GSerg 2012-01-30 09:06:48