Hi,
What you mean with local address? it's an IP in the same computer?
in anycase there is not, you will have to generate a list of local ips, and
then use the AddressList to compare with it.
now, if
www.domainname.com does not change you can do it once in the
global.asasx app_init method and store it either in Application or in a
static variable
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Code Monkey" <dlynes2005@gmail.com> wrote in message
news:1127382284.772431.318060@g49g2000cwa.googlegr oups.com...[color=blue]
> Hope someone can help me out here.
>
>
> I'm writing some code (web forms) to see where a specific domain name
> resolves and if its not a local address, redirect to a specific
> redirect page.
>
>
> <code>
> IPHostEntry IPHost = Dns.Resolve("www.domainname.com");
> IPAddress[] addr = IPHost.AddressList;
> for (int i = 0;i < addr.Length;i++)
> {
> Response.Write(addr[i] + "<br/>");
>
>
> }
>
>
> </code>
>
> That code works fine.
> Now, local IP addresses are:
>
>
> 10.0.0.0 - 10.255.255.255
> 172.16.0.0 - 172.31.0.0
> 192.168.0.0 - 192.168.255.0
>
>
> is there a built in function in C# that's effectively a
> 'isLocalIPaddress()' ? Or do I have to code this the long way round on
> each individual octect of the given IP of the domain name?
>[/color]