473,516 Members | 3,399 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to obtain the public IP address of a machine outside the firewall

We have several offices that have a DSL or Cable modem where the IP address
is dynamic and changes often. I created a VB app that obtains the IP address
but it obtains the IP address within the firewall and we need the public IP
address of the machine outside the firewall so we can use Remote Desktop
connection for problem resolution etc.

Here is my current code:
Dim myWorkstation As String = System.Net.Dns.GetHostName()

Dim IPAdress As String =
System.Net.Dns.Resolve(myWorkstation).AddressList( 0).ToString

Dim MachineName As String = Environment.MachineName

How can I obtain the other IP address?

Thanks.


Nov 20 '05 #1
4 2652
Ed:

I have been able to do it with:

Request.ServerVariables.Item("REMOTE_HOST")

In web applications that I have written.

Hope that helps!

Fred

"Ed Willis" <ed*******@acsi.orgnospam> wrote in message
news:eZ**************@TK2MSFTNGP09.phx.gbl...
We have several offices that have a DSL or Cable modem where the IP address is dynamic and changes often. I created a VB app that obtains the IP address but it obtains the IP address within the firewall and we need the public IP address of the machine outside the firewall so we can use Remote Desktop
connection for problem resolution etc.

Here is my current code:
Dim myWorkstation As String = System.Net.Dns.GetHostName()

Dim IPAdress As String =
System.Net.Dns.Resolve(myWorkstation).AddressList( 0).ToString

Dim MachineName As String = Environment.MachineName

How can I obtain the other IP address?

Thanks.


Nov 20 '05 #2
How can you do it in a Web Service?

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:ui*************@TK2MSFTNGP12.phx.gbl...
Ed:

I have been able to do it with:

Request.ServerVariables.Item("REMOTE_HOST")

In web applications that I have written.

Hope that helps!

Fred

"Ed Willis" <ed*******@acsi.orgnospam> wrote in message
news:eZ**************@TK2MSFTNGP09.phx.gbl...
We have several offices that have a DSL or Cable modem where the IP

address
is dynamic and changes often. I created a VB app that obtains the IP

address
but it obtains the IP address within the firewall and we need the public

IP
address of the machine outside the firewall so we can use Remote Desktop
connection for problem resolution etc.

Here is my current code:
Dim myWorkstation As String = System.Net.Dns.GetHostName()

Dim IPAdress As String =
System.Net.Dns.Resolve(myWorkstation).AddressList( 0).ToString

Dim MachineName As String = Environment.MachineName

How can I obtain the other IP address?

Thanks.



Nov 20 '05 #3
Dim objHttpRequest As HttpRequest

Dim objHttpContext As HttpContext

Dim FirewallIPAddress As String

objHttpContext = HttpContext.Current()

objHttpRequest = objHttpContext.Request

FirewallIPAddress = objHttpRequest.ServerVariables("REMOTE_HOST")

There it is. Just add it to the web service method.

"Ed Willis" <ed*******@acsi.orgnospam> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
How can you do it in a Web Service?

"Fred Nelson" <fr**@smartybird.com> wrote in message
news:ui*************@TK2MSFTNGP12.phx.gbl...
Ed:

I have been able to do it with:

Request.ServerVariables.Item("REMOTE_HOST")

In web applications that I have written.

Hope that helps!

Fred

"Ed Willis" <ed*******@acsi.orgnospam> wrote in message
news:eZ**************@TK2MSFTNGP09.phx.gbl...
We have several offices that have a DSL or Cable modem where the IP

address
is dynamic and changes often. I created a VB app that obtains the IP

address
but it obtains the IP address within the firewall and we need the public
IP
address of the machine outside the firewall so we can use Remote

Desktop connection for problem resolution etc.

Here is my current code:
Dim myWorkstation As String = System.Net.Dns.GetHostName()

Dim IPAdress As String =
System.Net.Dns.Resolve(myWorkstation).AddressList( 0).ToString

Dim MachineName As String = Environment.MachineName

How can I obtain the other IP address?

Thanks.




Nov 20 '05 #4
Try this:

<%
Option Explicit

Dim m_strExternalIP
Dim m_strInternalIP

m_strExternalIP = getExternalIP()
m_strInternalIP = Request.ServerVariables("LOCAL_ADDR")

function getExternalIP()
Const m_IP = "http://www.ShowMyIP.com/xml"
Dim objXML
Set objXML = CreateObject("MSXML2.DomDocument")
with objXML
.resolveExternals = true
.async = false
.load(m_IP)
getExternalIP = .documentElement.SelectSingleNode("ip").text
end with
Set objXML = Nothing
end function

%>

This was the only way to get my true IP.

Hope this helps:

Raul Costa
nospan_jrpcosta_at_hotmail_dot_com (Remove nospan_ and replace _at_ with @
and _dot_ with . )
Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2779
by: Rajesh Kapur | last post by:
Hello, We use Informix and MySQL on linux/unix to drive our web application. SQL*Server is used only for backend enterprise applications within the firewall. I am trying to get the management to use SQL*Server outside the firewall. They tell me there are security issues with Microsoft products, including SQL*Server, that make it vulnerable...
5
6654
by: Jeronimo Bertran | last post by:
Hello, We have developed a socket tcpip server in .net that accepts calls from clients. Using the connected socket we are able to use the Socket.RemoteEndPoint to obtain the IP address of the client. Is there any way to obtain the MAC address for the client? Thanks Jeronimo
9
1969
by: John J. Hughes II | last post by:
I have a system where my software sits on one server and interacts with another server running MS SQL. My software recieves connects via a socket layer on the internet and does it's thing with the SQL. This seems to work fine. The problem is now I have a situation where the internet connect is on another server with firewall. When I...
10
4608
by: Michael | last post by:
I built two programs, one is a server and the other one is the client, I want those two programs to work on the same machine and to exchange information through the internet. IPAddress ipAddress = IPAddress.Parse(my IP); IPEndPoint localEndPoint = new IPEndPoint(ipAddress, port); I use this same code in the both programs except for the port...
6
28436
by: MajorTom | last post by:
Hello, I getting this error An established connection was aborted by the software in your host machine here: TcpClient smtpSocket = new TcpClient(_serverSmtp, _portSmtp) port = 25 (smtp server) and my smtp server is working fine from the outlook program
8
10370
by: MrNobody | last post by:
I need to find out the IP address of my local network on the WAN. There is alot of information on getting my local machine IP address but I can't find anything for getting the IP address my network is on. I was thinking I could make a HTTP Request to a server which displays your IP address as they see it and scrape it out of the response but...
8
11355
by: Paul Bromley | last post by:
Thanks for your tolerance on this list. I asked the question regarding Commercial Copy Protection along with Unique PC Idnetifier and obtaining the active IP address. This was all to identify and tie down software to each PC on a network. I have just realised that the unique identity that I need to go for on the network and should be easy to...
8
4148
by: Steven D'Aprano | last post by:
I have a PC behind a firewall, and I'm trying to programmatically determine the IP address visible from outside the firewall. If I do this: '127.0.0.1' ('localhost.localdomain', , ) I get my internal IP address, which is not what I want.
7
3309
by: Brian Cryer | last post by:
What I'm looking for is a way to tell if two sessions are from the same physical PC or from different PCs (within the same organisation say). This is with the view to possibly enforcing license restrictions, i.e. limiting the number of pcs that user account can connect from (say to 1 perhaps 2) but not the number of open sessions that user can...
0
7273
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7574
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7136
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7547
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5106
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3265
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3252
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.