Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi, to all.
i developing a webpage using asp.net with c# language, in this webpage
i have a textbox for taking url of the domain and button. when user
enter domain name in the textbox and press the button the details of
the domain will displaying in the other window. i take help from 'the code project' user and i get the code it is working fine, but when i
type the domain name particularly ".in" doamins are not giving details.
simply domain available message is displaying actually the domain is
registered for example i tried "axisbank.co.in" in my page it is
displaying the domain is available but actually it is already taken. I
am sending my code please help me ( particularly .in domain names)

C#
protected void btn_click(object sender,Event Args e)
{
    //   lblDomainName.Text = Session["WhoIs"].ToString();
    string firstLevelbufData = null;
    // Stores the bufData extracted from the webclient
    try
    {
        // similarly we can select any server address for bufData mining
        string strURL = "http://www.directnic.com/whois/index.php?query=" +  txtDomain.Text;
        WebClient web = new WebClient();
        // byte array to store the extracted bufData by webclient
        byte[] bufData = null;
        bufData = web.DownloadData(strURL);
        // got the bufData now convert it into string form
        firstLevelbufData = Encoding.Default.GetString(bufData);
    }
    catch (System.Net.WebException ex)
    {
        // this exception will be fired when the host name is not 
        //resolved or any other connection problem
        //txtResult.Text = ex.Message.ToString();//sasi
        lblresult.Text = ex.Message.ToString();
        return;
    }
    try
    {
        // first and last are the regular expression string for 
        //extraction bufData witnin two tags
        // you can change according to your requirement
        string first = null;
        string last = null;
        // chr(34) is used for (") symbol
        first = "<p class=\"text12\">";
        last = "</p>";
        Regex RE = new Regex(first + "(?<MYDATA>.*?(?=" + last + "))", 
                             RegexOptions.IgnoreCase | RegexOptions.Singleline);
        // try to extract the bufData  within the first and last tag
        Match m = RE.Match(firstLevelbufData);
        // got the result
        //txtResult.Text = m.Groups["MYDATA"].Value + "<br>";//sasi
        lblresult.Text = m.Groups["MYDATA"].Value + "<br>";
        // check if no information abour that domain is available
        //if (txtResult.Text.Length < 10) txtResult.Text = 
        //"Domain "+ txtDomain .Text +" is Available";//sasi
        if (lblresult.Text.Length < 10)
            lblresult.Text = "Domain " + txtDomain.Text+ " is Available";
    }
    catch (System.Net.WebException ex)
    {
        lblresult.Text = " Sorry the  information is currently not available !! ";
    }
}



Help me thank u

[Modified: added code formatting]
Posted
Updated 19-Mar-10 12:44pm
v3

Implement this API, [^]. This works well for .in domains and there is no fee for 100 queries per day.
 
Share this answer
 

Hi
Just try the url

http://www.directnic.com/whois/index.php?query=axisbank.co.in

its giving the result as "Sorry, but our WHOIS does not support the top level domain name"
The site you are using do not support .co.in domain type.

So, you need to search for API, which support major domain types.

There is no error in code

 

 

 


 

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900