Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
Hi,

I want to list all the sub domain names listed on an IP. Using the tools available on the internet (http://www.reverseipcheck.com/index.php?id=1), I am getting correct info. But my program is returning the error given below :

SocketException caught!!!Source : SystemMessage : The requested name is valid and was found in the database, but it does not have the correct associated data being resolved for .



The code used by me is :
C#
string IpAddressString = "64.187.125.151";

           try
           {
               IPAddress hostIPAddress = IPAddress.Parse(IpAddressString);
               IPHostEntry hostInfo = Dns.GetHostByAddress("64.187.125.151");
               // Get the IP address list that resolves to the host names contained in
               // the Alias property.
               IPAddress[] address = hostInfo.AddressList;
               // Get the alias names of the addresses in the IP address list.
               String[] alias = hostInfo.Aliases;
               Response.Clear();
               Response.Write("Host name : " + hostInfo.HostName);
               Response.Write("\nAliases :");
               for (int index = 0; index < alias.Length; index++)
               {
                   Response.Write(alias[index]);
               }
               Response.Write("\nIP address list : ");
               for (int index = 0; index < address.Length; index++)
               {
                   Response.Write(address[index]);
               }
           }
           catch (SocketException e)
           {
               Response.Write("SocketException caught!!!");
               Response.Write("Source : " + e.Source);
               Response.Write("Message : " + e.Message);
           }
           catch (FormatException e)
           {
               Response.Write("FormatException caught!!!");
               Response.Write("Source : " + e.Source);
               Response.Write("Message : " + e.Message);
           }
           catch (ArgumentNullException e)
           {
               Response.Write("ArgumentNullException caught!!!");
               Response.Write("Source : " + e.Source);
               Response.Write("Message : " + e.Message);
           }
           catch (Exception e)
           {
               Response.Write("Exception caught!!!");
               Response.Write("Source : " + e.Source);
               Response.Write("Message : " + e.Message);
           }
           Console.ReadLine();



The ip used above is "64.187.125.151", showing good results when using 'readymade' tools to find subdomains.

Any help would be appreciated. Thanks.
Anurag
Posted
Updated 26-Oct-10 3:06am
v3
Comments
@nuraGGupta@ 3-Sep-10 8:23am    
No Help till now !!! :( :( :( ... will someone please tell me, if this is possible or not?

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