Hello
How can i find ip address of visitors who visit my web site .also store these ip in my database.how it done
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Ritesh Diyawar101 reputationPosted Oct 14, 2010, 11:25 PM EDT
u should use this line in Asp.net
HttpContext.Current.Request.UserHostAddress;
Digamber Patil15 reputationPosted Oct 15, 2010, 1:01 AM EDT
Posted Oct 15, 2010, 2:13 AM EDT
Request.ServerVariables("remote_addr") instead of Request.Servervariables("REMOTE_HOST").
"REMOTE_HOST" willl return the name of the host machine if your server is set up to perform reverse DNS lookup when the site is accessed.
http://www.w3schools.com/asp/showasp.asp?filename=demo_server
You will get the IPAddress for the visitor.
Digamber Patil15 reputationPosted Oct 15, 2010, 4:13 AM EDT
Posted Oct 15, 2010, 5:56 AM EDT
<%
Dim oGeoIP,strErrMsg
Dim strIP,strCountryName,strCountryCode
Set oGeoIP = New CountryLookup
oGeoIP.GeoIPDataBase = Server.MapPath("GeoIP.dat")
If oGeoIP.ErrNum(strErrMsg) <> 0 Then
Response.Write(strErrMsg)
Else
strIP = request.ServerVariables("REMOTE_ADDR")
strCountryName = oGeoIP.lookupCountryName(strIP)
strCountryCode = oGeoIP.lookupCountryCode(strIP)
End If
Set oGeoIP = Nothing
%>
http://www.codetoad.com/asp_geoip.asp
http://www.ip2location.com/free.asp
http://www.aspsnippets.com/Articles/Find-Visitors-Geographic-Location-using-IP-Address-in-ASP.Net.aspx
http://ipaddressextensions.codeplex.com/
http://stackoverflow.com/questions/1409108/how-to-get-visitor-location-country-state-and-city-using-asp-net