how to get user's HostName, IP, and MAC Address ? and how to store in database?
how to get user's HostName, IP, and MAC Address ? and store in database?when user's visit site automatically store in data base
help me plz
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Anil KumarPosted Feb 24, 2015, 12:50 AM
Khargesh RajputPosted Feb 22, 2015, 10:25 PM
public string IpAddress()
{
string strIpAddress;
strIpAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (strIpAddress == null)
{
strIpAddress = Request.ServerVariables["REMOTE_ADDR"];
}
return strIpAddress;
}
Anil KumarPosted Feb 22, 2015, 11:17 AM
Sample code :-
IPHostEntry objEntry = Dns.GetHostEntry(Dns.GetHostName());
IPAddress[] arrAddress = objEntry .AddressList;
string host = objEntry .HostName.ToString();
string ip = arrAddress [2].ToString();
Don't forget to include the namespace.
Play with the object, i hope you'll find something for getting physical address as well