Discussion:
Host Name (Remote IP Address) Lookup
(too old to reply)
Robert
2008-07-17 04:12:50 UTC
Permalink
Hi,

I am attempting to find a way to use IntraWeb features to read the
host IP of the web user who accessed to the home page. I have read
other posts, which no one has come up with the best solution.

I know IntraWeb has the "restricted" IP addresses feature. This is
where I want to know where (and how) the IP address can be read by the
RestrictedIPs service in IWServerController property, as i want to log
all inbound web user's IP addresses. What I'm saying is that if the
RestrictedIPs service is available, why can't we know what IP address
it detects?

After reading many hpp header files, I found something that may be
worth to look at which I'm detailing here:

in ServerController.cpp code (I use C++Builder 2007), the
TIWServerController::IWServerControllerBaseNewSession function may be
used to extract the remote IP address:

ASession->Data = new TIWUserSession(NULL);
MainForm->LogMemo->Lines->Add(ASession->IP); // main form has the Memo
named LogoMemo

Please advise on what is needed to be done to allow for extracting the
remote user IP address.

Thanks,

Robert J. Rademacher
Robert
2008-07-17 15:23:22 UTC
Permalink
Hi all,

After doing some tests, my suggestion for capturing the web user IP
address as described above works very well.

Here is the details on how to accomplish this task:

1) Edit the function in ServerController.cpp:

Function name: TIWServerController::IWServerControllerBaseNewSession

ASession->Data = new TIWUserSession(NULL);//this one creates the web
user session
//Add this line:
MainForm->RemoteIPAddress = ASession->IP;//RemoteIPAddress AnsiString
is declared in Public in Main.h (form = MainForm)


2) In IW Web Form, add IWLabel named RemoteIP to the web form.
3) In FormCreate function (double-click on same IW Web form where
RemoteIP IWLabel is placed there), and add this line:
RemoteIP->Caption = MainForm->RemoteIPAddress;

What's nice is that the RemoteIP IWLabel has the captured IP address
stored on that specific form. This step will allow for correct IP
address (as well as time/date) stamp to log file, as well as saving it
to database on the fly. I tested this feature with several computers
(different IP addresses), which the web form displays the correct IP
address.

Hope this valuable tip is useful.

Cheers,

Robert J. Rademacher
m***@gmail.com
2012-07-26 05:07:02 UTC
Permalink
My advise on what is needed to be done to allow for extracting the
remote user IP address.You can extract the remote IP address using
the web site http://www.ip-details.com/.It also gives hostname,
the location details such as country, region/state, city,
latitude, longitude and telephone area code,and a
location specific map.

Continue reading on narkive:
Loading...