Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting the real IP
Message
De
16/09/2013 21:32:46
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Getting the real IP
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:
01583370
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?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform