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;

public partial class tool_Default1 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string text = this.ip.Text;
        string iPByDomain = this.GetIPByDomain(text);
        string str3 = IPLocation.IPLocate(base.Server.MapPath("~/tool/QQWry.Dat"), iPByDomain);
        this.Label1.Text = "查询结果→IP地址：" + iPByDomain + " 地理位置：" + str3;

    }
    public string GetIPByDomain(string url)
    {
        string str;
        if (url.Trim() == string.Empty)
        {
            return "";
        }
        try
        {
            str = Dns.GetHostEntry(url).AddressList.GetValue(0).ToString();
        }
        catch (Exception exception)
        {
            throw exception;
        }
        return str;
    }

}
