Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting the real IP
Message
De
17/09/2013 01:57:24
 
 
À
16/09/2013 21:32:46
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01583370
Message ID:
01583372
Vues:
60
>I have this to get the IP of the server:
>
>
>    ' Return the IP address
>    Public Function GetIP() As String
>        Dim lcIP As String
>        Dim loIPHostEntry As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName)
>
>        lcIP = loIPHostEntry.AddressList.GetValue(0).ToString
>
>        Return lcIP
>    End Function
>
>
>However, as we know it, on a 64 bit environment, this returns ::1 from ASP.NET. While this has never been a factor so far, I was relying on that to recognize the incoming hit from the Web server in a load balancing environment. Anyone knows how to obtain the real IP of the server in ASP.NET?

Rather than "64 bit environment" I think you meant "ipv6 environment". The "::1" value you're getting back is the local loopback address, the ipv6 equivalent of the ipv4 127.0.0.1.

This link should help: http://stackoverflow.com/questions/151231/how-do-i-get-the-local-network-ip-address-of-a-computer-programmatically-c
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform