Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getting the real IP
Message
From
16/09/2013 21:32:46
 
 
To
All
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Getting the real IP
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01583370
Message ID:
01583370
Views:
61
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
Next
Reply
Map
View

Click here to load this message in the networking platform