You can also refer this
Save User's IPAddress and Time of Visit in database in ASP.Net
Or you can insert the IpAddress by adding these code in your cs file.
Namespaces
using System.Configuration;
using System.Data.SqlClient;
C#
protected void Button1_Click(object sender, EventArgs e)
{
string ip = ipaddress.InnerHtml;
string constr = ConfigurationManager.ConnectionStrings["conString"].ConnectionString;
string sqlStatment = "INSERT INTO TableName VALUES(@IPAddress)";
using (SqlConnection con = new SqlConnection(constr))
{
using (SqlCommand cmd = new SqlCommand(sqlStatment, con))
{
con.Open();
cmd.Parameters.AddWithValue("@IPAddress", Convert.ToDateTime(ip));
cmd.ExecuteNonQuery();
con.Close();
}
}
}