protected void Button1_Click(object sender, EventArgs e)
{
string strHostName = System.Net.Dns.GetHostName();
string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();
SqlCommand cmd = new SqlCommand("insert into tblIpAddress(IPAddress)values(@IPAddress)", con);
cmd.Parameters.AddWithValue("@IPAddress", clientIPAddress);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}