Get domain name from IP address

 Hi all,

          I want to convert an Ip address to corresponding domain name if any. Do i really need to use some third party components like IP2location .. Guys Please help..

   thanks in advance

please click 'Mark as Answer' if my post helped you.
5/1/2009 12:37:21 PM 91979 articles. 3 followers. Follow

5 Replies

Similar Articles

[PageSpeed] 11

5/1/2009 12:45:27 PM

HostName = System.Net.Dns.GetHostName();

IPAddres = System.Net.Dns.GetHostAddresses(HostName).GetValue(0).ToString();


Please "Mark as Answer" if this has helped you.
5/1/2009 1:03:15 PM

 The above link is dead (please check it out)


To get host name and ip address use the following code:


Dim myHost As String = System.Net.Dns.GetHostName
Dim myIPs As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(myHost)
Response.Write("The name of the host is = " & myIPs.HostName & "<br />")
For Each myIP As System.Net.IPAddress In myIPs.AddressList
Response.Write("The IP address of host is = " & myIP.ToString)
// C#.NET
string myHost = System.Net.Dns.GetHostName;
System.Net.IPHostEntry myIPs = System.Net.Dns.GetHostEntry(myHost);
Response.Write("The name of the host is = " + myIPs.HostName + "<br />");
foreach (System.Net.IPAddress myIP in myIPs.AddressList) {
Response.Write("The IP address of host is = " + myIP.ToString);
When you ask a question, remember to click "Mark As Answer" when you get a reply which answers your question.
5/1/2009 1:04:45 PM

 System.Net.Dns.GetHostAddresses("").GetValue(0).ToString() return ur ip address

Ahsan Murshed
Please "Mark as Answered" if helpful for you.
5/2/2009 12:00:22 PM

 check this , It may help for u 



Md. Parves Kawser

Please remember to click,
remember to click

"Mark As Answer"

on the post that helps you.
5/2/2009 12:44:06 PM

Similar Artilces:

Lookup IP Address to get domain name
Hi I have a datagrid which has a list of IP Addresses in it, I would like to resolve the IP address to show its fully qualified domain name (if found) in another column of the datagrid. Is this possible?  Is there a web service i can use, or is this functionality built into .net 2.0?Thanks in advance Check out this article: Darrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you! hi,here is some information for you ,hope it helps

How Do I get rid of \\ ( ie\\ipp//:ip address/ipp/printer) out of the start of my printer name
Hi, How Do I get rid of \\ out of the start of my printer name, I think this is stopping me printing to some printers with certain drivers(HP driver don't seem to mind). If I set printers up manual I do not have this problem and the driver works with the printer, but if I use the automated iprint way it adds \\ to the start of the printer name and it hangs my spooler file. Michael, It appears that in the past few days you have not received a response to your posting. That concerns us, and has triggered this automated reply. Has your problem been resolved? If not, you might ...

Hi, I'm at a loss to explain this... I have an ASPX page that I can't always navigate to. When I developed the app (it's Starter Kit Portal-based), I did it on my LAN and have had no trouble accessing the page. However, upon deployment, I see the following behavior: 1. POST request goes out looking for MyForm.aspx 2. GET request for MyForm.aspx 3. GET request for MyForm.aspx 4. ... X. GET request Sometimes, the page finally loads. Other times, it just ends up blank. Many times, it doesn't load at ALL the first POST - I just get a "The pa...

How to get domain user's first name, last name and e-mail address
Hi everyone, I am able to retrieve the domain/user ID by setting <authentication mode="Windows"/> in the Web.config file, and with the following code in my Default.aspx.,cs page: string strName = Request.ServerVariables["AUTH_USER"]; I would also like to retrieve the users first name, last name and e-mail address from their domain profile, if possible.  Can anyone help me with a code example?  I'm somewhat new to C#/.NET/OOP so if you have it in "C# for Dummies" format, I would be very thankful! Thanks in advance for any help that i...

How to get Hostname, IP address, port number, DB name, instance name using Query
As we know, normally we connect to a sybase server by just identifying the node name and interfaces file and necessary properties, but currently I want to get Host-name, IP address, port number, DB name, instance name of connected server out after connection created. Does any one how to use query to do so? Does sybase provide such functionality? Seems oracle can do so... If there is no query, does sybase provides any API which can implement this? Thanks! instance name: select @@servername [assumes the DBA has defined a local entry in syservers] db name: select db_name() [can...

Getting NIC to get a dynamic IP address from Cable Modem
Does anyone know how to get my NW 6 server to get a dynamic IP address from a cable/DSL modem? Thanks, Kevin DHCPCLNT name=board_name Add /INETCFG to the end of that to have DHCPCLNT update your INETCFG information for you. After it does that, you'll probably need to manually enable Dynamic NAT on the interface. bd NSC Volunteer SysOp ...

Get host name from IP address
does anyone have any simple C# code that can do this?pwpaust Try this.  It's a simple page that looks up both IP and name.  I've put in some data to test with, but you can enter your own text!   <%@ Page Language="C#" %> <%@ Import Namespace="System.Net" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <script runat="server"> protected string DNSLookup(string domain) { string result = string.Empty; try { IPHostEntry ipHe = Dns.GetHostEntry(domain); IPAddress[] ipAd...

How to get IP address/name of the machine
Hi all, I have a requirement to find out IP address/name of the machine to which a given windows user is currently logged on. Is that possible with C#? If anyone has came across sample code please guide me to appropriate resource. Blog: SEO Articles Website: Search Engine Ranking Are you looking for this? Request.UserHostAddress()   Jef Claes~~~~~~~~~~Visit my blog Hi, Please try to use my code: public static string IPAddress { get { string userIP; HttpRequest Request = HttpContext....

How to get IP address or name of the server?
I need to get the IP address or name of the server that runs my application. Which class, method should I use? Thanks! Try this: Request.ServerVariables["SERVER_NAME"]Darrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you! Thank you very much. I tried "SERVER_NAME", but it gives me more info than I need. I used Request.ServerVariables["HTTP_HOST"] instead. ...

Getting a domain name and email address
Hi On security now Leo mentioned getting one's own domain name and email address to avoid problems with a provider like Yahoo changing things about your email that you don't like. He said ' very strong argument for buying a domain name of your very own and using it for your email address, so you have a permanent address. And then if something like this happens, you don't have to worry about it, you just move it to some other service. ' So I was thinking if I got my own domain name and email, can it be purchase...

Get IP address from network interface name
Hello! I have been using the TNTFirewall component (NTSet) to retreive the network devices of my computer. I get a lot of information för each device eg. NTFireWall.Connections[I].Name, NTFireWall.Connections[I].DeviceName, NTFireWall.Connections[I].GuidId. What I can't find is the currently assigned IP address of each device (if available). How can I get the current IP address assigned to these connections using the above properties? The values are as an example: Name = 'Anslutning till lokalt nätverk' DeviceName = 'Attansic L1 Gigabit Ethernet...

how to get network workstations ip address and their name
Hi guys last week I downloaded spiceworks it works pretty good. Basicaly it is a web page system that shows my workstations in my network and their hardware, software configurations. I started wondering if there is a program that written in or  I searched the NET, however I couldn't find good source. There are few scripts out there however none of them works. Maybe I need to read a little about it, Again I didn't see any source that explaines the basics (foundation of) of this subject.   Could you please send me some ideas of yours, including; where I can fin...

How to get user name or user ip address?
Hi to all! I have written a little survey application for our intranet. In order to prevent users from taking the survey a second (3rd, 4th, 5th...) time, the app should detect the user name, or the ip address of the session. Does someone know how to manage this with WebMatrix? Thanks! Bye, MichaelTo finish first, you first have to finish. Sure, you can use the Request object. Request.UserHostAddressStanley Tan theSpoke Blog Stanley, thanks! I searched the MSDN library. I found this article

get IP Address _ Server Name
Hi , All Does anyone know how to get IP Address of Server Name ? Im using PB9.0 and SQL Server 2000 We have four servers and all the same servername(the same SQLCA.servername), just different IP Address . I would like to get IP address to know what server the user has connected . Thanks for helping! ---== Posted via the PFCGuide Web Newsreader ==--- You do a winsock getaddrinfo call: There's also a GetAddrInfoEx call that might work better (it shoul...

Web resources about - Get domain name from IP address -

File:Ipv6 address.svg - Wikipedia, the free encyclopedia
I, the copyright holder of this work, release this work into the public domain . This applies worldwide. This file contains additional information, ...

Barack Obama outlines counter-terrorism plans in rare Oval Office address; vows to 'destroy' Islamic ...
US president Barack Obama brands Islamic State fighters thugs and killers in a rare address to the nation in the wake of last week's California ...

The backwards notion that Obama was late for the glamorous 2015 Kennedy Center Honors because he needed ...
Here's the standard presentation of that notion in People Magazine , replete with video, from which I grabbed this still. But I think the address ...

Figure out how to address your cover letter - Business Insider Deutschland
... a specific individual. Just because a job posting omits the name of the person in charge of the hiring process doesn't mean you should address ...

Obama speaks on ISIS, gun control, tolerance in Oval Office address - Videos - CBS News
... shows terrorism is now in a new phase. He promised to destroy anyone who tries to harm Americans. It was the president’s first address from ...

Clinton to address terror protection
As domestic terror fears rise, Hillary Clinton is set to explain how she will protect Americans, reports NBC News.

President Obama's Address: 'Freedom Is More Powerful Than Fear'
Here is the full text of his speech, as provided by the White House. Tonight, I addressed the nation from the Oval Office on my top priority ...

In weekly address, Obama asks Americans to 'stay true to who we are' in fight against terrorism
x YouTube Video This week, like last week, President Obama devoted his weekly address to the fight against terrorism. As I said in my speech ...

Obama’s Sunday Address Watched By 46 Million Viewers
... Obama 's Sunday night primetime speech might have, according to GOP White House candidates, been too little too late – and why give the address ...

How Global Capital Markets Firms Can Address Profit Pressures
With the low-hanging fruit already picked, banks need to go deeper to find cost savings.

Resources last updated: 12/15/2015 4:51:50 PM