GetHostByName Nightmares

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Alex Sinclair (Alex77_at_notvalidyahoo.com)
Date: 03/21/04


Date: Sun, 21 Mar 2004 12:08:01 -0800

Hi,

I'm trying to get the ip address of a website given its hostname. I'm
using the System.Net.Dns.GetHostByName(<hostname>)
using C# and ASP.NET.

This is not working reliably at all: for example. www.yahoo.com works just
fine, returning back the IP address, on the other hand, Google, MS, Sun, and
numerous others just return a Socket Exception:

"The requested name is valid and was found in the database, but it does not
have the correct associated data being resolved for"

Is there any other way to get the IP address of a website in a reliable
manner? why does this work using ping or tracert but doesn't work in
ASP.NET? (haven't checked using the Win32 API lately, but I have the feeling
it would work just fine).

Thanks,

Alex



Relevant Pages

  • Re: Finding Virtual ips
    ... If you mean to find virtual hosts for an ip: ... Enter a hostname, e.g. www.hackthis.com or an ip like 209.200.153.152 to ... Audit your website security with Acunetix Web Vulnerability Scanner: ... Cross site scripting and other web attacks before hackers do! ...
    (Pen-Test)
  • Re: Finding Virtual ips
    ... Enter a hostname, e.g. www.hackthis.com or an ip like 209.200.153.152 to ... Audit your website security with Acunetix Web Vulnerability Scanner: ... Cross site scripting and other web attacks before hackers do! ...
    (Pen-Test)
  • Re: Who is bookmarking my site?
    ... > Oliver Wong wrote: ... address and a hostname can vary with time, so if you really need that info, ... If you want that info to be available to a client to your website (e.g. ... The Apache HTTP server, for example, is capapble of logging the IP ...
    (comp.lang.java.programmer)
  • [OT] Re: =?UTF-8?Q?R=C3=A9sum=C3=A9s?= posted to a website are for public consumption, obviously
    ... let me get a hostName from an IP address when ... Résumés posted to a website are for public consumption, ... Troy Piggins ...
    (news.software.readers)
  • Re: help with network problem
    ... Since it is a bbs site, when I use ping ... and it was working..And the ISP doesnt block that site. ... >Thread-Topic: help with network problem ... >1) The website is not running (Having successful PING doesn't guarantee ...
    (Security-Basics)