What you want to see on DotNetFunda.com ?
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 12037 |  Welcome, Guest!   Register  Login
 Home > Code Snippets > ASP.NET > Fully Qualified Domain Name(DNS) ...
Gopesh9

Fully Qualified Domain Name(DNS)

 Code Snippet posted by: Gopesh9 | Posted on: 8/3/2012 | Category: ASP.NET Codes | Views: 441 | Status: [Member] | Points: 40 | Alert Moderator   


<%@ Page Language="c#" Debug="true" %>

<%@ Import Namespace="System" %>
<%@ Import Namespace="System.Net" %>
<html>
<title>Performing a DNS Lookup </title>
<head>
<script language="c#" runat="server">
void Btn_Click(Object sender,EventArgs e) {
try
{
LblName.Text = "";
IPHostEntry GetIPHost = Dns.GetHostByName(TxtInput.Text);
LblValue.Text = "DNS LookUp as : " + "<Br>";
foreach(IPAddress ip in GetIPHost.AddressList)
{
long HostIpaddress = ip.Address;
LblValue.Text += HostIpaddress.ToString() + " -- ";
LblValue.Text += ip.ToString() + "<Br>";

}
LblHostName.Text = "Host Name is: " + GetIPHost.HostName;
}catch(Exception ex){
LblValue.Text = "<font color=red>Error:" + ex.Message;
}
}

</script>
</head>
<body>
<h3><font face="Verdana">DNS lookup for a particular Fully Qualified Domain Name.</font></h3>
<form runat="server">
Please enter Fully qualified Domain name:
<asp:TextBox id="TxtInput" runat="server" value="www.google.com" /><br />
<asp:Button id="BtnCheck" Text="Click Me" onclick="BtnCheck_Click" runat="server" /><br />
<br />
<asp:Label id="LblValue" runat="server" /><br />
<asp:Label id="LblHostName" runat="server" />
</form>
</body>
</html>


G. S.
.Net Developer
Found interesting? Add this to:


>> Write Response - Respond to this post and get points

More codes snippets

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/22/2013 5:55:49 AM