I am trying to get the IP address of the PC that will be updating records in database and insert into one of the field of the record. I get need the local LAN IP for now as the application using VB 2500 express with MySQL will be running in a local LAN.
Vincent

How to get IP address
PatPhilippot
How about something like this There's a lot of information in the System.Net namespace, but this is what I found by scouting around, but there may be an easier way:
Imports
System.Net.NetworkInformationPublic Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim adapters As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
Dim adapter As NetworkInterface
For Each adapter In adapters
Debug.WriteLine(adapter.Description)
Dim adapterProperties As IPInterfaceProperties = adapter.GetIPProperties()
Dim addresses As UnicastIPAddressInformationCollection = adapterProperties.UnicastAddresses
If addresses.Count > 0 Then
Dim addr As UnicastIPAddressInformation
For Each addr In addresses
Debug.WriteLine("Address: " & addr.Address.ToString())
Next addr
End If
Next adapter
End Sub
End Class
NewASPNETUser
Dim sIPAddress
sIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If sIPAddress="" Then sIPAddress = Request.ServerVariables("REMOTE_ADDR")
BobH
Give the below code a try. Just keep in mind that a host machine can be assigned more than one IP address:
Dim IpEntry As System.Net.IPHostEntry = System.Net.Dns.GetHostEntry(Environment.MachineName)Dim IpAddr As System.Net.IPAddress() = IpEntry.AddressList
Dim IpAddrIndex As IntegerFor IpAddrIndex = 0 To IpAddr.Length - 1
Next
9072
Stephen Davies.