Mayur Gondaliya

Information Technology Enthusiast

Subscribe to Mayur Gondaliya

Fetching domain whois information using asp.net

Posted by Mayur Gondaliya On March - 14 - 2010

There are several domain whois checking websites available today. For example, who.is and domaintools.com are broadly used. It is very easy to develop such web application of your own. All you need to query the whois server for a domain in question. Here is the sample code, that fetches the whois information associated with the domain provided in the query.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Sockets;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string domainname = Request.QueryString["domain"].ToString();
TcpClient objTCPC = new TcpClient();
objTCPC.Connect(“whois.enom.com”, 43);
string strDomain = domainname;// +”\\r\\n”;
byte[] arrDomain = Encoding.ASCII.GetBytes(strDomain);
Stream objStream = objTCPC.GetStream();
objStream.Write(arrDomain, 0, strDomain.Length);
StreamReader objSr = new StreamReader(objTCPC.GetStream(),Encoding.ASCII);
string strServerResponse = objSr.ReadToEnd();
strServerResponse = Regex.Replace(strServerResponse, “\n”, “<br>”);
Response.Write(strServerResponse);
objTCPC.Close();

}
}

Above code will query the whois server whois.enom.com to get the whois information of ask4asp.net. You can use any whois servers. I am listing some of them below.
whois.arin.net
whois.ripe.net
whois.apnic.net
whois.lacnic.net
whois.afrinic.net
whois.enom.com, etc.

Google Buzz

About the Author

Leave a Reply

About Us

Hi, welcome to my website.Explore the site and enjoy your stay and remember to come back with your friends.

Flickr

amrita_aamrita_damrita_camrita_be1d9