using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Net; using System.Text; public partial class IpInfo : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string ipUrl = "http://www.hostip.info/api/get.html?ip=" + Request.UserHostAddress; WebClient webClient = new WebClient(); Byte[] ipInfoBytes = webClient.DownloadData(ipUrl); UTF8Encoding encoding = new UTF8Encoding(); string ipInfo = encoding.GetString(ipInfoBytes); Response.Write(ipInfo); } }


2 comments:
string ipUrl = "http://www.hostip.info/api/get.html?ip=" + Request.UserHostAddress;
Above url returns 404 Error - Not fount.
You can use instead:
http://api.hostip.info/get_html.php?ip=12.215.42.19
Can you give the code in C#.Net program
Post a Comment