Check the Domain Details on WHOIS using ASP.NET
Introduction
WHOIS is a query/response
protocol that is widely used for querying databases in order to determine the
registrant or assignee of Internet resources, such as a domain name, an IP
address block, or an autonomous system number. WHOIS services are typically
communicated using the Transmission Control Protocol (TCP). Servers listen to
requests on the well-known port number 43.
The WHOIS system originated as a method for system administrators to obtain contact information for IP address assignments or domain name administrators. The use of the data in the WHOIS system has evolved into a variety of uses, including:
• Supporting the security and stability of the Internet by providing contact points for network operators and administrators, including ISPs, and certified computer incident response teams.
• Determining the registration status of domain names.
• Assisting law enforcement authorities in investigations for enforcing national and international laws, including, for example, countering terrorism-related criminal offenses and in supporting international cooperation procedures. In some countries, specialized non-governmental entities may be involved in this work.
• Assisting in the combating against abusive uses of Information communication technology, such as illegal and other acts motivated by racism, racial discrimination, xenophobia, and related intolerance, hatred, violence, all forms of child abuse, including pedophilia and child pornography, the trafficking in, and exploitation of, human beings.
• Facilitating inquiries and subsequent steps to conduct trademark clearances and to help counter intellectual property infringement, misuse and theft in accordance with applicable national laws and international treaties.
• Contributing to user confidence in the Internet as a reliable and efficient means of information and communication and as an important tool for promoting digital inclusion, e-commerce and other legitimate uses by helping users identify persons or entities responsible for content and services online.
• Assisting businesses, other organizations and users in combating fraud, complying with relevant laws and safeguarding the interests of the public.
In this article, we will use only two pages .aspx and .aspx.vb.
The WHOIS system originated as a method for system administrators to obtain contact information for IP address assignments or domain name administrators. The use of the data in the WHOIS system has evolved into a variety of uses, including:
• Supporting the security and stability of the Internet by providing contact points for network operators and administrators, including ISPs, and certified computer incident response teams.
• Determining the registration status of domain names.
• Assisting law enforcement authorities in investigations for enforcing national and international laws, including, for example, countering terrorism-related criminal offenses and in supporting international cooperation procedures. In some countries, specialized non-governmental entities may be involved in this work.
• Assisting in the combating against abusive uses of Information communication technology, such as illegal and other acts motivated by racism, racial discrimination, xenophobia, and related intolerance, hatred, violence, all forms of child abuse, including pedophilia and child pornography, the trafficking in, and exploitation of, human beings.
• Facilitating inquiries and subsequent steps to conduct trademark clearances and to help counter intellectual property infringement, misuse and theft in accordance with applicable national laws and international treaties.
• Contributing to user confidence in the Internet as a reliable and efficient means of information and communication and as an important tool for promoting digital inclusion, e-commerce and other legitimate uses by helping users identify persons or entities responsible for content and services online.
• Assisting businesses, other organizations and users in combating fraud, complying with relevant laws and safeguarding the interests of the public.
In this article, we will use only two pages .aspx and .aspx.vb.
Default.aspx
<%@
Page Language="vb" AutoEventWireup="false"
Inherits="DataScrapping.WhoIs" CodeFile="Default.aspx.vb"
%>
<html>
<body style="text-align:
left">
<form
id="Form1" name="Form1" runat="server">
<div
align="center" style="text-align: left">
<span
style="font-size: 10pt; font-family:
Verdana"><strong><span style="font-size: 14pt;
color: #3300ff;
text-decoration: underline">Check the Domain Details on
WHOIS</span></strong><br />
<br />
<br />
</span>
<table style="font-size:
10pt; font-family: Verdana;" bgcolor="#dcdcdc"
width="100%">
<tr>
<td
colspan="3">
********************************</td>
</tr>
<tr>
<td colspan="3">
<asp:Label
id="Label2" runat="server" Font-Size="X-Small"
Font-Names="Verdana" ForeColor="Navy"
Font-Bold="True">www.</asp:Label>
<asp:TextBox
id="txtDomain" runat="server" Font-Size="X-Small"
Font-Names="Verdana" Font-Bold="True"
Width="263px">Enter your Domain Name Here</asp:TextBox>
<asp:Button
id="btnQuery" runat="server" Text="Trace Domain
Details" Width="139px" Font-Size="X-Small"
Font-Names="Arial" ForeColor="Black"
Font-Bold="False" BorderColor="White"
BackColor="DarkGray"></asp:Button>
<asp:Label
id="Label1" runat="server" Width="232px"
Font-Size="X-Small" Font-Names="Verdana"
ForeColor="Navy" Font-Bold="True">Example:
itorian.com</asp:Label></td>
</tr>
<tr>
<td
colspan="3">
***********************</td>
</tr>
<tr>
<td colspan="3">
<asp:Label
id="txtResult" runat="server" ForeColor="Blue"
Font-Names="Verdana" Font-Bold="True"
Font-Size="X-Small"></asp:Label></td>
</tr>
</table>
</div>
</form>
</body>
</html>
Default.aspx.vb
Imports
System.Net.Sockets
Imports
System.Text
Imports
System.IO
Imports
System.Collections
Imports
System.Net
Imports
System.Text.RegularExpressions
Namespace
DataScrapping
Partial Class WhoIs
Inherits System.Web.UI.Page
#Region
" Web Form Designer Generated Code "
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
InitializeComponent()
End Sub
#End
Region
Private Sub Page_Load(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txtDomain.Attributes.Add("onclick",
"this.value='';")
End Sub
Private Sub btnQuery_Click(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles btnQuery.Click
Dim firstLevelbufData As String
Try
Dim strURL As String =
"http://www.directnic.com/whois/index.php?query=" txtDomain.Text
Dim web As New WebClient()
Dim bufData As Byte()
bufData =
web.DownloadData(strURL)
firstLevelbufData =
Encoding.Default.GetString(bufData)
Catch ex As System.Net.WebException
txtResult.Text = ex.Message()
Exit Sub
End Try
Try
Dim first, last As String
first = "<p
class=" Chr(34) "text12" Chr(34)
">"
last = "</p>"
Dim RE As New Regex(first "(?<MYDATA>.*?(?=" last
"))", RegexOptions.IgnoreCase Or RegexOptions.Singleline)
Dim m As Match =
RE.Match(firstLevelbufData)
txtResult.Text =
m.Groups("MYDATA").Value
"<br>"
If txtResult.Text.Length <
10 Then txtResult.Text = "Some Error Occured."
Catch e3 As Exception
txtResult.Text = "Some
Error Occured."
End Try
End Sub
End Class
End
Namespace
Comments
Post a Comment