İyinet'e Hoşgeldiniz!

Türkiye'nin En Eski Webmaster Forum'una Hemen Kayıt Olun!

Kayıt Ol!

asp.net .aspx (c#) ile domain whois

BigCoder

0
İyinet Üyesi
Katılım
22 Eylül 2010
Mesajlar
30
Reaction score
0
Konum
Istanbul
PHP:
<%@ Page Language="C#" ContentType="text/html"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Web.UI" %>
<%@ Import Namespace="System.Web.UI.WebControls" %>
<%@ Import Namespace="System.Net.Sockets" %>
<%@ Import Namespace="System.IO" %>
<script language="c#" runat="server">
        protected void Page_Load(object sender, EventArgs e)
        {
            lblSonuc.Visible = false;
        }

        public static string GetWhois(string WhoisServeri, string DomainName)
        {
            string WhoisResult = string.Empty;
            try
            {
                if (WhoisServeri.Length > 2)
                {
                    TcpClient tcpc = new TcpClient();
                    tcpc.Connect("" + WhoisServeri + "", 43);
                    string strDomain = DomainName + System.Environment.NewLine;
                    byte[] arrDomain = Encoding.ASCII.GetBytes(strDomain.ToCharArray());
                    Stream s = tcpc.GetStream();
                    s.Write(arrDomain, 0, strDomain.Length);
                    StreamReader sr = new StreamReader(tcpc.GetStream(), Encoding.Default);
                    WhoisResult = sr.ReadToEnd();
                }
            }
            catch
            { }
            return WhoisResult;
        }

        protected void btnGonder_Click(object sender, EventArgs e)
        {
            lblSonuc.Visible = true;

            string blnDomain = txtDomain.Text.ToLower().Trim();
            string whoisIcinDomain = txtDomain.Text.ToLower().Trim();
            string[] Parcala = blnDomain.Split('.');
            int kactane = Parcala.Length - 1; // tr  com

            string blnTLD = Parcala[kactane]; // tld bulundu

            string Selected_WhoIs_Server = string.Empty;
            bool IkinciSorgu = false;
            string WhoisBilgileri = string.Empty;

            switch (blnTLD)
            {
                case "ad":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "ae":
                    Selected_WhoIs_Server = "whois.aeda.net.ae";
                    break;
                case "aero":
                    Selected_WhoIs_Server = "whois.aero";
                    break;
                case "af":
                    Selected_WhoIs_Server = "whois.nic.af";
                    break;
                case "ag":
                    Selected_WhoIs_Server = "whois.nic.ag";
                    break;
                case "ai":
                    Selected_WhoIs_Server = "whois.ai";
                    break;
                case "al":
                    Selected_WhoIs_Server = "nic.al";
                    break;
                case "am":
                    Selected_WhoIs_Server = "whois.amnic.net";
                    break;
                case "arpa":
                    Selected_WhoIs_Server = "whois.iana.org";
                    break;
                case "as":
                    Selected_WhoIs_Server = "whois.nic.as";
                    break;
                case "asia":
                    Selected_WhoIs_Server = "whois.nic.asia";
                    break;
                case "at":
                    Selected_WhoIs_Server = "whois.nic.at";
                    break;
                case "au":
                    Selected_WhoIs_Server = "whois.ausregistry.net";
                    break;
                case "az":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "be":
                    Selected_WhoIs_Server = "whois.dns.be";
                    break;
                case "bg":
                    Selected_WhoIs_Server = "whois.register.bg";
                    break;
                case "biz":
                    Selected_WhoIs_Server = "whois.biz";
                    break;
                case "bj":
                    Selected_WhoIs_Server = "whois.nic.bj";
                    break;
                case "bo":
                    Selected_WhoIs_Server = "whois.nic.bo";
                    break;
                case "by":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "bz":
                    Selected_WhoIs_Server = "bzwhois.verisign-grs.co";
                    break;
                case "ca":
                    Selected_WhoIs_Server = "whois.cira.ca";
                    break;
                case "cat":
                    Selected_WhoIs_Server = "whois.cat";
                    break;
                case "cc":
                    Selected_WhoIs_Server = "ccwhois.verisign-grs.com";
                    IkinciSorgu = true;
                    break;
                case "ch":
                    Selected_WhoIs_Server = "whois.nic.ch";
                    break;
                case "ci":
                    Selected_WhoIs_Server = "whois.nic.ci";
                    break;
                case "ck":
                    Selected_WhoIs_Server = "whois.ck-nic.org.ck";
                    break;
                case "cl":
                    Selected_WhoIs_Server = "whois.nic.cl";
                    break;
                case "cn":
                    Selected_WhoIs_Server = "whois.cnnic.net.cn";
                    break;
                case "com":
                    Selected_WhoIs_Server = "whois.opensrs.net";
                    IkinciSorgu = true;
                    break;
                case "coop":
                    Selected_WhoIs_Server = "whois.nic.coop";
                    break;
                case "cx":
                    Selected_WhoIs_Server = "whois.nic.cx";
                    break;
                case "cy":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "cz":
                    Selected_WhoIs_Server = "whois.nic.cz";
                    break;
                case "de":
                    Selected_WhoIs_Server = "whois.denic.de";
                    break;
                case "dk":
                    Selected_WhoIs_Server = "whois.dk-hostmaster.dk";
                    break;
                case "dm":
                    Selected_WhoIs_Server = "whois.nic.dm";
                    break;
                case "do":
                    Selected_WhoIs_Server = "ns.nic.do";
                    break;
                case "ec":
                    Selected_WhoIs_Server = "whois.nic.ec";
                    break;
                case "edu":
                    Selected_WhoIs_Server = "whois.educause.edu";
                    break;
                case "ee":
                    Selected_WhoIs_Server = "whois.eenet.ee";
                    break;
                case "eg":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "es":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "eu":
                    Selected_WhoIs_Server = "whois.eu";
                    break;
                case "fi":
                    Selected_WhoIs_Server = "whois.ficora.fi";
                    break;
                case "fo":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "fr":
                    Selected_WhoIs_Server = "whois.nic.fr";
                    break;
                case "ga":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "gb":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "gd":
                    Selected_WhoIs_Server = "whois.adamsnames.com";
                    break;
                case "ge":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "gg":
                    Selected_WhoIs_Server = "whois.gg";
                    break;
                case "gi":
                    Selected_WhoIs_Server = "whois2.afilias-grs.net";
                    break;
                case "gl":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "gm":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "gov":
                    Selected_WhoIs_Server = "whois.dotgov.gov";
                    break;
                case "gr":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "gs":
                    Selected_WhoIs_Server = "whois.nic.gs";
                    break;
                case "gy":
                    Selected_WhoIs_Server = "whois.registry.gy";
                    break;
                case "hk":
                    Selected_WhoIs_Server = "whois.hkirc.hk";
                    break;
                case "hm":
                    Selected_WhoIs_Server = "webhost1.capital.hm";
                    break;
                case "hn":
                    Selected_WhoIs_Server = "whois2.afilias-grs.net";
                    break;
                case "hr":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "ht":
                    Selected_WhoIs_Server = "whois.nic.ht";
                    break;
                case "hu":
                    Selected_WhoIs_Server = "whois.nic.hu";
                    break;
                case "ie":
                    Selected_WhoIs_Server = "whois.domainregistry.ie";
                    break;
                case "il":
                    Selected_WhoIs_Server = "whois.isoc.org.il";
                    break;
                case "im":
                    Selected_WhoIs_Server = "whois.nic.im";
                    break;
                case "in":
                    Selected_WhoIs_Server = "whois.inregistry.net";
                    break;
                case "info":
                    Selected_WhoIs_Server = "whois.afilias.net";
                    break;
                case "int":
                    Selected_WhoIs_Server = "whois.iana.org";
                    break;
                case "io":
                    Selected_WhoIs_Server = "whois.nic.io";
                    break;
                case "ir":
                    Selected_WhoIs_Server = "whois.nic.ir";
                    break;
                case "is":
                    Selected_WhoIs_Server = "whois.isnic.is";
                    break;
                case "it":
                    Selected_WhoIs_Server = "whois.nic.it";
                    break;
                case "je":
                    Selected_WhoIs_Server = "whois.je";
                    break;
                case "jo":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "jobs":
                    Selected_WhoIs_Server = "jobswhois.verisign-grs.com";
                    break;
                case "jp":
                    Selected_WhoIs_Server = "whois.jprs.jp";
                    break;
                case "ke":
                    Selected_WhoIs_Server = "whois.kenic.or.ke";
                    break;
                case "kg":
                    Selected_WhoIs_Server = "whois.domain.kg";
                    break;
                case "ki":
                    Selected_WhoIs_Server = "whois.nic.ki";
                    break;
                case "kp":
                    Selected_WhoIs_Server = "whois.kcce.kp";
                    break;
                case "kr":
                    Selected_WhoIs_Server = "whois.nic.or.kr";
                    break;
                case "kz":
                    Selected_WhoIs_Server = "whois.nic.kz";
                    break;
                case "la":
                    Selected_WhoIs_Server = "whois.nic.la";
                    break;
                case "li":
                    Selected_WhoIs_Server = "whois.nic.li";
                    break;
                case "lt":
                    Selected_WhoIs_Server = "whois.domreg.lt";
                    break;
                case "lu":
                    Selected_WhoIs_Server = "whois.dns.lu";
                    break;
                case "lv":
                    Selected_WhoIs_Server = "whois.nic.lv";
                    break;
                case "ly":
                    Selected_WhoIs_Server = "whois.nic.ly";
                    break;
                case "ma":
                    Selected_WhoIs_Server = "whois.iam.net.ma";
                    break;
                case "mc":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "md":
                    Selected_WhoIs_Server = "whois.nic.md";
                    break;
                case "me":
                    Selected_WhoIs_Server = "whois.meregistry.net";
                    break;
                case "mg":
                    Selected_WhoIs_Server = "whois.nic.mg";
                    break;
                case "mk":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "mn":
                    Selected_WhoIs_Server = "whois.nic.mn";
                    break;
                case "mobi":
                    Selected_WhoIs_Server = "whois.dotmobiregistry.net";
                    break;
                case "ms":
                    Selected_WhoIs_Server = "whois.nic.ms";
                    break;
                case "mt":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "mu":
                    Selected_WhoIs_Server = "whois.nic.mu";
                    break;
                case "museum":
                    Selected_WhoIs_Server = "whois.museum";
                    break;
                case "mx":
                    Selected_WhoIs_Server = "whois.nic.mx";
                    break;
                case "my":
                    Selected_WhoIs_Server = "whois.mynic.net.my";
                    break;
                case "na":
                    Selected_WhoIs_Server = "whois.na-nic.com.na";
                    break;
                case "name":
                    Selected_WhoIs_Server = "whois.nic.name";
                    break;
                case "net":
                    Selected_WhoIs_Server = "whois.verisign-grs.com";
                    IkinciSorgu = true;
                    break;
                case "nl":
                    Selected_WhoIs_Server = "whois.domain-registry.nl";
                    break;
                case "no":
                    Selected_WhoIs_Server = "whois.norid.no";
                    break;
                case "nu":
                    Selected_WhoIs_Server = "whois.nic.nu";
                    break;
                case "nz":
                    Selected_WhoIs_Server = "whois.srs.net.nz";
                    break;
                case "org":
                    Selected_WhoIs_Server = "whois.publicinterestregistry.net";
                    break;
                case "pe":
                    Selected_WhoIs_Server = "kero.yachay.pe";
                    break;
                case "pl":
                    Selected_WhoIs_Server = "whois.dns.pl";
                    break;
                case "pm":
                    Selected_WhoIs_Server = "whois.nic.pm";
                    break;
                case "pr":
                    Selected_WhoIs_Server = "whois.nic.pr";
                    break;
                case "pro":
                    Selected_WhoIs_Server = "whois.registrypro.pro";
                    break;
                case "pt":
                    Selected_WhoIs_Server = "whois.dns.pt";
                    break;
                case "re":
                    Selected_WhoIs_Server = "whois.nic.re";
                    break;
                case "ro":
                    Selected_WhoIs_Server = "whois.rotld.ro";
                    break;
                case "ru":
                    Selected_WhoIs_Server = "whois.ripn.net";
                    break;
                case "sa":
                    Selected_WhoIs_Server = "whois.saudinic.net.sa";
                    break;
                case "sb":
                    Selected_WhoIs_Server = "whois.nic.net.sb";
                    break;
                case "sc":
                    Selected_WhoIs_Server = "whois2.afilias-grs.net";
                    break;
                case "se":
                    Selected_WhoIs_Server = "whois.iis.se";
                    break;
                case "sg":
                    Selected_WhoIs_Server = "whois.nic.net.sg";
                    break;
                case "sh":
                    Selected_WhoIs_Server = "whois.nic.sh";
                    break;
                case "si":
                    Selected_WhoIs_Server = "whois.arnes.si";
                    break;
                case "sk":
                    Selected_WhoIs_Server = "whois.sk-nic.sk";
                    break;
                case "sm":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "sn":
                    Selected_WhoIs_Server = "whois.nic.sn";
                    break;
                case "so":
                    Selected_WhoIs_Server = "whois.nic.so";
                    break;
                case "st":
                    Selected_WhoIs_Server = "whois.nic.st";
                    break;
                case "su":
                    Selected_WhoIs_Server = "whois.ripn.net";
                    break;
                case "tc":
                    Selected_WhoIs_Server = "whois.adamsnames.tc";
                    break;
                case "tel":
                    Selected_WhoIs_Server = "whois.nic.tel";
                    break;
                case "tf":
                    Selected_WhoIs_Server = "whois.nic.tf";
                    break;
                case "th":
                    Selected_WhoIs_Server = "whois.thnic.net";
                    break;
                case "tk":
                    Selected_WhoIs_Server = "whois.dot.tk";
                    break;
                case "tl":
                    Selected_WhoIs_Server = "whois.nic.tl";
                    break;
                case "tm":
                    Selected_WhoIs_Server = "whois.nic.tm";
                    break;
                case "tn":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "to":
                    Selected_WhoIs_Server = "whois.tonic.to";
                    break;
                case "tr":
                    Selected_WhoIs_Server = "whois.nic.tr";
                    break;
                case "travel":
                    Selected_WhoIs_Server = "whois.nic.travel";
                    break;
                case "tv":
                    Selected_WhoIs_Server = "tvwhois.verisign-grs.com";
                    IkinciSorgu = true;
                    break;
                case "tw":
                    Selected_WhoIs_Server = "whois.twnic.net.tw";
                    break;
                case "ua":
                    Selected_WhoIs_Server = "whois.net.ua";
                    break;
                case "ug":
                    Selected_WhoIs_Server = "whois.co.ug";
                    break;
                case "uk":
                    Selected_WhoIs_Server = "whois.nic.uk";
                    break;
                case "us":
                    Selected_WhoIs_Server = "whois.nic.us";
                    break;
                case "uy":
                    Selected_WhoIs_Server = "whois.nic.org.uy";
                    break;
                case "uz":
                    Selected_WhoIs_Server = "whois.cctld.uz";
                    break;
                case "va":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                case "vc":
                    Selected_WhoIs_Server = "whois2.afilias-grs.net";
                    break;
                case "ve":
                    Selected_WhoIs_Server = "whois.nic.ve";
                    break;
                case "vg":
                    Selected_WhoIs_Server = "whois.adamsnames.tc";
                    break;
                case "wf":
                    Selected_WhoIs_Server = "whois.nic.wf";
                    break;
                case "ws":
                    Selected_WhoIs_Server = "whois.website.ws";
                    break;
                case "xxx":
                    Selected_WhoIs_Server = "whois.nic.xxx";
                    break;
                case "yt":
                    Selected_WhoIs_Server = "whois.nic.yt";
                    break;
                case "yu":
                    Selected_WhoIs_Server = "whois.ripe.net";
                    break;
                default:
                    Selected_WhoIs_Server = "??";
                    WhoisBilgileri = "Domainin Tamamını Yazın (www olmadan)";
                    break;
            }

            

            if (IkinciSorgu == true)
            {
                try
                {

                    string BilgiCek = GetWhois(Selected_WhoIs_Server, whoisIcinDomain);

                    string birinci = "Whois Server:";
                    string ikinci = "Referral URL:";
                    int first = BilgiCek.IndexOf(birinci);
                    int last = BilgiCek.LastIndexOf(ikinci);

                    if (BilgiCek.IndexOf(birinci) != -1)
                    {
                        string str2 = BilgiCek.Substring(first + birinci.Length, last - ikinci.Length - first).Trim();

                        WhoisBilgileri = GetWhois(str2, whoisIcinDomain);
                    }
                    else
                    {

                        WhoisBilgileri = BilgiCek;
                    
                    }

                }
                catch
                {
                    WhoisBilgileri = "Bağlantı Hatası Oluştu !";
                }
            }
            else
            {

                WhoisBilgileri = GetWhois(Selected_WhoIs_Server, whoisIcinDomain);
            }
            lblSonuc.Text = WhoisBilgileri;

        }
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>.ASPX Whois (c#)</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:TextBox ID="txtDomain" runat="server"></asp:TextBox>
        <asp:Button ID="btnGonder" runat="server" onclick="btnGonder_Click" Text="WHOIS" />
    </div>
    <br />
    <h2>WHOİS SONUCU :</h2>
    <hr />
    <pre>
    <asp:Label ID="lblSonuc" runat="server"></asp:Label>
    </pre>
    </form>
</body>
</html>
 

asilus

0
İyinet Üyesi
Katılım
20 Mart 2012
Mesajlar
2
Reaction score
0
Güzel paylaşım

Ellerinize sağlık; çalışan güzel bir uygulama.
Çok işime yaradı.
Teşekkürler...
:harika:
 

Türkiye’nin ilk webmaster forum sitesi iyinet.com'da forum üyeleri tarafından yapılan tüm paylaşımlardan; Türk Ceza Kanunu’nun 20. Maddesinin, 5651 Sayılı Kanununun 4. maddesinin 2. fıkrasına göre, paylaşım yapan üyeler sorumludur.

Backlink ve Tanıtım Yazısı için iletişime geçmek için Skype Adresimiz: .cid.1580508955483fe5

Üst