473,805 Members | 2,001 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(myWorks tation).Address List(0).ToStrin g

Dim MachineName As String = Environment.Mac hineName

How can I obtain the other IP address?

Thanks.


Nov 20 '05 #1
4 2669
Ed:

I have been able to do it with:

Request.ServerV ariables.Item(" REMOTE_HOST")

In web applications that I have written.

Hope that helps!

Fred

"Ed Willis" <ed*******@acsi .orgnospam> wrote in message
news:eZ******** ******@TK2MSFTN GP09.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(myWorks tation).Address List(0).ToStrin g

Dim MachineName As String = Environment.Mac hineName

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**@smartybir d.com> wrote in message
news:ui******** *****@TK2MSFTNG P12.phx.gbl...
Ed:

I have been able to do it with:

Request.ServerV ariables.Item(" REMOTE_HOST")

In web applications that I have written.

Hope that helps!

Fred

"Ed Willis" <ed*******@acsi .orgnospam> wrote in message
news:eZ******** ******@TK2MSFTN GP09.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(myWorks tation).Address List(0).ToStrin g

Dim MachineName As String = Environment.Mac hineName

How can I obtain the other IP address?

Thanks.



Nov 20 '05 #3
Dim objHttpRequest As HttpRequest

Dim objHttpContext As HttpContext

Dim FirewallIPAddre ss As String

objHttpContext = HttpContext.Cur rent()

objHttpRequest = objHttpContext. Request

FirewallIPAddre ss = objHttpRequest. ServerVariables ("REMOTE_HOS T")

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

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

"Fred Nelson" <fr**@smartybir d.com> wrote in message
news:ui******** *****@TK2MSFTNG P12.phx.gbl...
Ed:

I have been able to do it with:

Request.ServerV ariables.Item(" REMOTE_HOST")

In web applications that I have written.

Hope that helps!

Fred

"Ed Willis" <ed*******@acsi .orgnospam> wrote in message
news:eZ******** ******@TK2MSFTN GP09.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(myWorks tation).Address List(0).ToStrin g

Dim MachineName As String = Environment.Mac hineName

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.ServerV ariables("LOCAL _ADDR")

function getExternalIP()
Const m_IP = "http://www.ShowMyIP.co m/xml"
Dim objXML
Set objXML = CreateObject("M SXML2.DomDocume nt")
with objXML
.resolveExterna ls = true
.async = false
.load(m_IP)
getExternalIP = .documentElemen t.SelectSingleN ode("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
2786
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 to attacks outside the firewall. Can someone please point me to white papers/documentation that...
5
6711
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
1980
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 listen to the ports on the server my software is running on it seems I can not listen to the internet....
10
4639
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 number which is diferent. But there seems to be no connection. Maybe I use the wrong Ip number,...
6
28466
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
10383
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 I was hoping for a method which is less dependent on some server out on the web...
8
11381
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 get in a foolproof manner is the computer name. Hence which method will ALWAYS return the computer...
8
4169
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
3323
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 have. So, with that in mind I was wondering whether it was possible to obtain the local IP...
0
9716
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9596
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10604
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10356
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10361
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
10103
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9179
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6874
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

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.