473,385 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

WHOIS information

Hi all,

I want to query WHOIS info from my ASP.NET app.

I'd like to query a specific domain (e.g. google.com) and for availability
(e.g. google.eu (available/taken), google.nl (available/taken)).

Anyone knows a (commercial) component that gets this job done?

Kind Regards,
Roel
Jan 15 '07 #1
10 1971
I dabbled with this in the past. Here is a link to a class that will do
what you want

http://www.activevb.de/rubriken/vbdo.../tipp0038.html

There is one problem, though, your web host has to allow you to create
sockets. So this worked fine on my development computer, but no hosting
company that I deal with will allow the creation of sockets.
"Roel" <no_spam_pleasewrote in message
news:uq**************@TK2MSFTNGP03.phx.gbl...
Hi all,

I want to query WHOIS info from my ASP.NET app.

I'd like to query a specific domain (e.g. google.com) and for availability
(e.g. google.eu (available/taken), google.nl (available/taken)).

Anyone knows a (commercial) component that gets this job done?

Kind Regards,
Roel


Jan 15 '07 #2
"Roel" <no_spam_pleasewrote in message
news:uq**************@TK2MSFTNGP03.phx.gbl...
I want to query WHOIS info from my ASP.NET app.

I'd like to query a specific domain (e.g. google.com) and for availability
(e.g. google.eu (available/taken), google.nl (available/taken)).
You mean like this...?
http://www.markrae.com/hosting/domains.aspx
Anyone knows a (commercial) component that gets this job done?
There are loads of code samples on the net for this...
Jan 15 '07 #3
Hi Mark,

This is exactly what I mean!
I've searched for code samples on the net for this and there are many
indeed... but I can't get only one of them to work properly. Could you point
out some good examples? Thanx.

Roel

"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:eu**************@TK2MSFTNGP02.phx.gbl...
"Roel" <no_spam_pleasewrote in message
news:uq**************@TK2MSFTNGP03.phx.gbl...
>I want to query WHOIS info from my ASP.NET app.

I'd like to query a specific domain (e.g. google.com) and for
availability (e.g. google.eu (available/taken), google.nl
(available/taken)).

You mean like this...?
http://www.markrae.com/hosting/domains.aspx
>Anyone knows a (commercial) component that gets this job done?

There are loads of code samples on the net for this...

Jan 16 '07 #4
"Roel" <no_spam_pleasewrote in message
news:uq**************@TK2MSFTNGP02.phx.gbl...
This is exactly what I mean!
I've searched for code samples on the net for this and there are many
indeed... but I can't get only one of them to work properly. Could you
point out some good examples? Thanx.
You can use mine if you like:

using System.Net.Sockets;

string strDomain = String.Empty;
string strWhoIs = String.Empty;
string strResponse = String.Empty;

using (TcpClient objTcpClient = new TcpClient())
{
objTcpClient.Connect(strWhoIs, 43);
byte[] arrDomain = Encoding.ASCII.GetBytes(mstrDomain);
Stream objStream = objTcpClient.GetStream();
objStream.Write(arrDomain, 0, mstrDomain.Length);
StreamReader objSr = new StreamReader(objTcpClient.GetStream(),
Encoding.ASCII);
strResponse = objSr.ReadToEnd();
}

Then just interrogate the value of strResponse for the existence of either
the string "no match" or "not found" - if either of those strings exists in
strResponse, you haven't got a match, otherwise you have.

The value of strWhoIs will depend on the domain's suffix - I use the
following List<>:

com: whois.crsnic.net
net: whois.crsnic.net
org: whois.crsnic.net
edu: whois.crsnic.net
biz: whois.neulevel.biz
info: whois.afilias.info
name: whois.nic.name

For the country-specific domains (e.g. .co.uk, .co.ca, .co.de etc) you
prefix the country code with "whois.nic." I.e. for a UK domain, you would
use whois.nic.uk and for a Canadian domain you would use whois.nic.ca etc...

Also, if the domain is a .com or a .net, you should put the string "domain "
in front of it, otherwise you'll get all the nameservers too... :-)

Incidentally, whereas this code *does* work, it's quite old now, and
searches on .biz domains always seem to time out... If anyone has any better
code for this, I'd be grateful to see it.
Jan 16 '07 #5
Hi, Mark.

Here's what I wrote, which works well:

void EnterBtn_Click(Object Src, EventArgs E)
{
String DomainName = Message.Text ;
String server = servers.SelectedItem.Text ;
TcpClient tcpc = new TcpClient(server, 43);
NetworkStream stream = tcpc.GetStream();
StreamWriter writer = new StreamWriter(stream);
StreamReader reader = new StreamReader(stream);
writer.AutoFlush = true;
writer.WriteLine(DomainName);
String line;
while ((line=reader.ReadLine())!=null)
Response.Write(line + "<br>");
tcpc.Close();
}

Test it and see if it works any better (post back the results if you do).

re:
searches on .biz domains always seem to time out
I use whois.nic.biz ( which I think is an alias for whois.neulevel.biz )
and seldom get timeouts.


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message news:OZ**************@TK2MSFTNGP02.phx.gbl...
"Roel" <no_spam_pleasewrote in message news:uq**************@TK2MSFTNGP02.phx.gbl...
>This is exactly what I mean!
I've searched for code samples on the net for this and there are many indeed... but I can't get
only one of them to work properly. Could you point out some good examples? Thanx.

You can use mine if you like:

using System.Net.Sockets;

string strDomain = String.Empty;
string strWhoIs = String.Empty;
string strResponse = String.Empty;

using (TcpClient objTcpClient = new TcpClient())
{
objTcpClient.Connect(strWhoIs, 43);
byte[] arrDomain = Encoding.ASCII.GetBytes(mstrDomain);
Stream objStream = objTcpClient.GetStream();
objStream.Write(arrDomain, 0, mstrDomain.Length);
StreamReader objSr = new StreamReader(objTcpClient.GetStream(), Encoding.ASCII);
strResponse = objSr.ReadToEnd();
}

Then just interrogate the value of strResponse for the existence of either the string "no match"
or "not found" - if either of those strings exists in strResponse, you haven't got a match,
otherwise you have.

The value of strWhoIs will depend on the domain's suffix - I use the following List<>:

com: whois.crsnic.net
net: whois.crsnic.net
org: whois.crsnic.net
edu: whois.crsnic.net
biz: whois.neulevel.biz
info: whois.afilias.info
name: whois.nic.name

For the country-specific domains (e.g. .co.uk, .co.ca, .co.de etc) you prefix the country code
with "whois.nic." I.e. for a UK domain, you would use whois.nic.uk and for a Canadian domain you
would use whois.nic.ca etc...

Also, if the domain is a .com or a .net, you should put the string "domain " in front of it,
otherwise you'll get all the nameservers too... :-)

Incidentally, whereas this code *does* work, it's quite old now, and searches on .biz domains
always seem to time out... If anyone has any better code for this, I'd be grateful to see it.

Jan 16 '07 #6
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:Os******************@TK2MSFTNGP02.phx.gbl...
Here's what I wrote, which works well:
<snip>

Looks good.
Test it and see if it works any better (post back the results if you do).
I will do so this evening...
>searches on .biz domains always seem to time out

I use whois.nic.biz ( which I think is an alias for whois.neulevel.biz )
and seldom get timeouts.
Thanks - I'll modify my List<accordingly.
Jan 16 '07 #7
Hello Mark,

Your example was very useful to me. Many thanks!

Kind Regards,
Roel
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message
news:OZ**************@TK2MSFTNGP02.phx.gbl...
"Roel" <no_spam_pleasewrote in message
news:uq**************@TK2MSFTNGP02.phx.gbl...
>This is exactly what I mean!
I've searched for code samples on the net for this and there are many
indeed... but I can't get only one of them to work properly. Could you
point out some good examples? Thanx.

You can use mine if you like:

using System.Net.Sockets;

string strDomain = String.Empty;
string strWhoIs = String.Empty;
string strResponse = String.Empty;

using (TcpClient objTcpClient = new TcpClient())
{
objTcpClient.Connect(strWhoIs, 43);
byte[] arrDomain = Encoding.ASCII.GetBytes(mstrDomain);
Stream objStream = objTcpClient.GetStream();
objStream.Write(arrDomain, 0, mstrDomain.Length);
StreamReader objSr = new StreamReader(objTcpClient.GetStream(),
Encoding.ASCII);
strResponse = objSr.ReadToEnd();
}

Then just interrogate the value of strResponse for the existence of either
the string "no match" or "not found" - if either of those strings exists
in strResponse, you haven't got a match, otherwise you have.

The value of strWhoIs will depend on the domain's suffix - I use the
following List<>:

com: whois.crsnic.net
net: whois.crsnic.net
org: whois.crsnic.net
edu: whois.crsnic.net
biz: whois.neulevel.biz
info: whois.afilias.info
name: whois.nic.name

For the country-specific domains (e.g. .co.uk, .co.ca, .co.de etc) you
prefix the country code with "whois.nic." I.e. for a UK domain, you would
use whois.nic.uk and for a Canadian domain you would use whois.nic.ca
etc...

Also, if the domain is a .com or a .net, you should put the string "domain
" in front of it, otherwise you'll get all the nameservers too... :-)

Incidentally, whereas this code *does* work, it's quite old now, and
searches on .biz domains always seem to time out... If anyone has any
better code for this, I'd be grateful to see it.

Jan 16 '07 #8
"Roel" <no_spam_pleasewrote in message
news:uc**************@TK2MSFTNGP03.phx.gbl...
Your example was very useful to me. Many thanks!
Welcome, but see also Juan's alternative code...
Jan 16 '07 #9
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:Os******************@TK2MSFTNGP02.phx.gbl...
Test it and see if it works any better (post back the results if you do).
At first, your code was a little quicker, but after I modified my code to
read:

NetworkStream objStream = objTcpClient.GetStream();

instead of

Stream objStream = objTcpClient.GetStream();

there was no appreciable difference... It now returns the 16 domain suffixes
in between one and two seconds, which is good enough for me... :-)
I use whois.nic.biz ( which I think is an alias for whois.neulevel.biz )
and seldom get timeouts.
Yep - that's fixed the timeouts - thanks.
Jan 17 '07 #10
Good news...on both counts!

NetworkStream is a bit more efficient. Don't ask me why. :-)
All I know is that it was suggested to me by someone who knows a lot!

Thanks for posting the results.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Mark Rae" <ma**@markNOSPAMrae.comwrote in message news:eD**************@TK2MSFTNGP04.phx.gbl...
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:Os******************@TK2MSFTNGP02.phx.gbl...
>Test it and see if it works any better (post back the results if you do).

At first, your code was a little quicker, but after I modified my code to read:

NetworkStream objStream = objTcpClient.GetStream();

instead of

Stream objStream = objTcpClient.GetStream();

there was no appreciable difference... It now returns the 16 domain suffixes in between one and
two seconds, which is good enough for me... :-)
>I use whois.nic.biz ( which I think is an alias for whois.neulevel.biz )
and seldom get timeouts.
Yep - that's fixed the timeouts - thanks.

Jan 17 '07 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: elyob | last post by:
I've got a number of domains, and want to check the expiry date automatically. There's plenty of whois scripts, but the output from the different whois servers are not always the same. Does...
6
by: Fred | last post by:
Hi ! Can some one give me a little step by step to put me onthe right way.. I'd like to use PHP with Postresql. I need to make many whois query on the domain names that we own, to store the...
5
by: Gerrit Muller | last post by:
I am migrating a website from a UNIX based machine to an Windows machine. In the logfiles I got from the old machine I mostly got domain names and sometimes only IP addresses. The Windows machine...
4
by: Vjay77 | last post by:
I am playing with idea to create a small application which will basically do this: - one textbox - you put in the name of any domain you wish (existing or not) - press the button - it should...
3
by: Vjay77 | last post by:
As a result from who is I am getting this: > > NOTICE AND TERMS OF USE: You are not authorized to access or query our WHOIS database through the use of high-volume, automated, electronic...
0
by: skip | last post by:
I'm looking to get whois information for a given domain from Python. I'm mostly interested in record update and creation dates at the moment, but eventually might want more. I stumbled upon a...
4
by: udaypawar | last post by:
Hi friends, I have just started my own web hosting business. I am PHP programmer and having good knowledge of PHP. I am designing my own website for hosting. I have designed all pages except one...
3
by: Phillip B Oldham | last post by:
Hi. I'm stretching my boundaries in programming with a little python shell-script which is going to loop through a list of domain names, grab the whois record, parse it, and put the results into a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.