Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hi friends,
i want to add domain name finding utility in my web site . is any web service is available for asp.net ?
Posted 21-Jun-12 5:06am
Comments
Manas Bhardwaj at 21-Jun-12 10:08am
   
Not clear!

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Following is a simple console program which checks whether if the domain name exists or not.
 
You can convert it into a webservice if you wish to.
 
using System;
using System.Linq;
using System.Net;
using System.Net.Sockets;
 
namespace DemoDNS
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter a domain for lookup.");
            var domainName = Console.ReadLine();
            try
            {
                var ipAddress = Dns.GetHostEntry(domainName);
                if (ipAddress.AddressList.Count() > 0)
                {
                    Console.WriteLine("The domain already exists!");
                }
            }
            catch (SocketException e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
}
  Permalink  
Comments
Pankaj Nikam at 21-Jun-12 10:26am
   
This solution is given as far as I understand the need of yours. If not, please reply me on this comment, I would love to help you. Thanks.
Abhishek Pant at 24-Nov-13 2:46am
   
+5
Worked for me too!! searching this from 2 days
Pankaj Nikam at 24-Nov-13 10:17am
   
Glad to be of help :)
Thanks for the upvote :)

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

  Print Answers RSS
0 OriginalGriff 341
1 Marcin Kozub 225
2 Sergey Alexandrovich Kryukov 220
3 Praneet Nadkar 197
4 Shweta N Mishra 161
0 OriginalGriff 8,149
1 Sergey Alexandrovich Kryukov 7,287
2 DamithSL 5,614
3 Manas Bhardwaj 4,986
4 Maciej Los 4,910


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 21 Jun 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100