我想要ASp.net的域名查找器Web服务 [英] I want Domain Name Finder web Service for ASp.net
本文介绍了我想要ASp.net的域名查找器Web服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
朋友们,
我想在我的网站中添加域名查找实用程序.
Hi friends,
i want to add domain name finding utility in my web site . is any web service is available for asp.net ?
推荐答案
下面是一个简单的控制台程序,它检查域名是否存在.
您可以根据需要将其转换为Web服务.
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);
}
}
}
}
这篇关于我想要ASp.net的域名查找器Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文