This doesn't attempt to take into account proxies. For that, you can use Request.ServerVariables["HTTP_X_FORWARDED_FOR"]. However, make sure you're not trusting that blindly, since it could be forged. It's better to keep a whitelist of IPs for which you trust it.
String strHostName = new String("");
// Getting Ip address of local machine...
// First get the host name of local machine.
strHostName = DNS.GetHostName();
// Then using host name, get the IP address list..
IPHostEntry ipEntry = DNS.GetHostByName(strHostName);
IPAddress addr = ipEntry.AddressList;