Detecting User’s IP Address

7 05 2008

If your website contains sensitive data and you don’t want any spamming or any malicious use of your website ,then one thing you can do is to keep a track of the visiting user’s system IP and this can be done in some easy steps given below,

string strHostName = System.Net.Dns.GetHostName();
string clientIPAddress = System.Net.Dns.GetHostAddresses(strHostName).GetValue(0).ToString();


Now set the value of clientIPAddress to either a Textbox or label or any control as per your requirement.


Actions

Information

2 responses

1 03 2009
Mike

Just passing by.Btw, you website have great content!

_________________________________
Did you know that over 94% of personal computers have hidden corrupt dangerous files with over 150 hidden errors and bugs on them?

1 03 2009
talibkhan

Thanks Mike …… Also . do check out my active blog at http:talibkhan.blogspot.com

:)

Leave a comment