Skip to main content

How To get IP Address to Country/State using

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 = "" + Request.UserHostAddress;
        WebClient webClient = new WebClient();
        Byte[] ipInfoBytes = webClient.DownloadData(ipUrl);
        UTF8Encoding encoding = new UTF8Encoding();
        string ipInfo = encoding.GetString(ipInfoBytes);




  1. string ipUrl = "" + Request.UserHostAddress;

    Above url returns 404 Error - Not fount.

    You can use instead:

  2. Can you give the code in C#.Net program


Post a Comment

Popular posts from this blog