2

Possible Duplicates:
How to get my own IP address in C#?
How to Get IP Address?

I want to store the IP Address to the DataBase table through C#.Net coding. How to get the static IP Address(What we get from www.whatismyip.com) using C#.Net? What are the ways to retrieve it?

Community
  • 1
  • 1
thevan
  • 10,052
  • 53
  • 137
  • 202

2 Answers2

2

You can get it through HttpContext.Current.Request.UserHostName

emre nevayeshirazi
  • 18,983
  • 12
  • 64
  • 81
1

You can get it like this:

HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];

Marty
  • 2,965
  • 4
  • 30
  • 45