472,790 Members | 1,419 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,790 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 1941
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: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.