473,805 Members | 2,017 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Obtain real IP address of client

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 address of a PC? I know I can use Request.UserHos tAddress but if
someone is behind a router (or proxy) then it just returns the external
public IP address. Is it possible to obtain the internal (real) IP address
of a visitor as well as their public IP address?

If not then does anyone have any other ideas for detecting whether two
sessions with the same Request.UserHos tAddress are from the same PC or not?

TIA.
--
Brian Cryer
www.cryer.co.uk/brian
Oct 25 '07 #1
7 3323
On Oct 25, 1:10 pm, "Brian Cryer" <bri...@127.0.0 .1.activesol.co .uk>
wrote:
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 address of a PC? I know I can use Request.UserHos tAddress but if
someone is behind a router (or proxy) then it just returns the external
public IP address. Is it possible to obtain the internal (real) IP address
of a visitor as well as their public IP address?

If not then does anyone have any other ideas for detecting whether two
sessions with the same Request.UserHos tAddress are from the same PC or not?

TIA.
--
Brian Cryerwww.cryer. co.uk/brian
first test HTTP_X_FORWARDE D_FOR and if it's not available, use
REMOTE_ADDR, or Request.UserHos tAddress

string ip = Request.ServerV ariables("HTTP_ X_FORWARDED_FOR ");
if(ip != "") {
ip=Request.Serv erVariables("RE MOTE_ADDR");
}

Oct 25 '07 #2
"Brian Cryer" <br****@127.0.0 .1.activesol.co .ukwrote in message
news:em******** ******@TK2MSFTN GP03.phx.gbl...
So, with that in mind I was wondering whether it was possible to obtain
the local IP address of a PC? I know I can use Request.UserHos tAddress but
if someone is behind a router (or proxy) then it just returns the external
public IP address. Is it possible to obtain the internal (real) IP address
of a visitor as well as their public IP address?
There is no reliable way to do this... For one thing, IP addresses are so
easy to spoof these days...
If not then does anyone have any other ideas for detecting whether two
sessions with the same Request.UserHos tAddress are from the same PC or
not?
You could look at cookies, I suppose, but what if the workstation has e.g.
IE, FireFox, Opera, Netscape and Safari installed (like I do on my test
machine)...?
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Oct 25 '07 #3
"Alexey Smirnov" <al************ @gmail.comwrote in message
news:11******** **************@ y42g2000hsy.goo glegroups.com.. .
On Oct 25, 1:10 pm, "Brian Cryer" <bri...@127.0.0 .1.activesol.co .uk>
wrote:
>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 address of a PC? I know I can use Request.UserHos tAddress but if
someone is behind a router (or proxy) then it just returns the external
public IP address. Is it possible to obtain the internal (real) IP
address
of a visitor as well as their public IP address?

If not then does anyone have any other ideas for detecting whether two
sessions with the same Request.UserHos tAddress are from the same PC or
not?

first test HTTP_X_FORWARDE D_FOR and if it's not available, use
REMOTE_ADDR, or Request.UserHos tAddress

string ip = Request.ServerV ariables("HTTP_ X_FORWARDED_FOR ");
if(ip != "") {
ip=Request.Serv erVariables("RE MOTE_ADDR");
}
Thanks Alexey. This is the best I've seen. I wasn't aware of
HTTP_X_FORWARDE D_FOR, useful to know about thanks.

This does the job if the person is going via a proxy, but not if they are
behind a router. If they are behind a router I still only see the public IP
address (although at least I now see the public IP address before it hits a
proxy). Its a big step in the right direction. Thanks.
--
Brian Cryer
www.cryer.co.uk/brian


Oct 25 '07 #4
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:Ou******** ******@TK2MSFTN GP05.phx.gbl...
"Brian Cryer" <br****@127.0.0 .1.activesol.co .ukwrote in message
news:em******** ******@TK2MSFTN GP03.phx.gbl...
>So, with that in mind I was wondering whether it was possible to obtain
the local IP address of a PC? I know I can use Request.UserHos tAddress
but if someone is behind a router (or proxy) then it just returns the
external public IP address. Is it possible to obtain the internal (real)
IP address of a visitor as well as their public IP address?

There is no reliable way to do this... For one thing, IP addresses are so
easy to spoof these days...
That's what I suspect.
>If not then does anyone have any other ideas for detecting whether two
sessions with the same Request.UserHos tAddress are from the same PC or
not?

You could look at cookies, I suppose, but what if the workstation has e.g.
IE, FireFox, Opera, Netscape and Safari installed (like I do on my test
machine)...?
I had a brief play with cookies, but didn't have much joy in getting values
back. Could have been a mistake in my code or simply that cookies are
blocked so often ...

Thank you for the idea.
--
Brian Cryer
www.cryer.co.uk/brian
Oct 25 '07 #5
Maybe what you really need to do is make people log in, and store their
credentials in such a way that if they log in a second time with the same
credentials, you'll be able to detect that's a duplicate login. Then you
needn't worry about IP addresses.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Brian Cryer" wrote:
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 address of a PC? I know I can use Request.UserHos tAddress but if
someone is behind a router (or proxy) then it just returns the external
public IP address. Is it possible to obtain the internal (real) IP address
of a visitor as well as their public IP address?

If not then does anyone have any other ideas for detecting whether two
sessions with the same Request.UserHos tAddress are from the same PC or not?

TIA.
--
Brian Cryer
www.cryer.co.uk/brian
Oct 25 '07 #6
"Peter Bromberg [C# MVP]" <pb*******@yaho o.yohohhoandabo ttleofrum.comwr ote
in message news:32******** *************** ***********@mic rosoft.com...
Maybe what you really need to do is make people log in, and store their
credentials in such a way that if they log in a second time with the same
credentials, you'll be able to detect that's a duplicate login. Then you
needn't worry about IP addresses.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
Detecting multiple logins by the same account is easy, but isn't what I'm
after. What I would like to be able to is to distinguish between multiple
sessions (logged in) from one pc and those which are from two or more pcs.
The rational being not to stop someone from having multiple browser windows
open on their pc, but to stop or at least detect if the same account is
logged in from two or more different pcs (in the same office). I hope you
can see what I'm aiming for.

I know there are issues like has the browser been closed without logging
off, but I can see workarounds for issues like those. Alexey has given a
work around that works for telling apart pcs behind a proxy, but I'm stuck
on how to tell two pcs apart which are behind the same router. Any ideas
appreciated.
--
Brian Cryer
www.cryer.co.uk/brian
Oct 25 '07 #7
"Brian Cryer" <br****@127.0.0 .1.activesol.co .ukwrote in message
news:uC******** ******@TK2MSFTN GP05.phx.gbl...
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:Ou******** ******@TK2MSFTN GP05.phx.gbl...
>"Brian Cryer" <br****@127.0.0 .1.activesol.co .ukwrote in message
news:em******* *******@TK2MSFT NGP03.phx.gbl.. .
>>So, with that in mind I was wondering whether it was possible to obtain
the local IP address of a PC? I know I can use Request.UserHos tAddress
but if someone is behind a router (or proxy) then it just returns the
external public IP address. Is it possible to obtain the internal (real)
IP address of a visitor as well as their public IP address?

There is no reliable way to do this... For one thing, IP addresses are so
easy to spoof these days...

That's what I suspect.
>>If not then does anyone have any other ideas for detecting whether two
sessions with the same Request.UserHos tAddress are from the same PC or
not?

You could look at cookies, I suppose, but what if the workstation has
e.g. IE, FireFox, Opera, Netscape and Safari installed (like I do on my
test machine)...?

I had a brief play with cookies, but didn't have much joy in getting
values back. Could have been a mistake in my code or simply that cookies
are blocked so often ...
My cookie implementation was wrong. My mistake.

So it looks like the cookie approach will give me what I need. I'd still
like a way to identify the PC (by IP address or name) for reporting purposes
(say to the user even) but that isn't so pressing.

Thanks.
--
Brian Cryer
www.cryer.co.uk/brian

Oct 25 '07 #8

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

Similar topics

1
13980
by: Roman Mashak | last post by:
Hello, All! I just started to learn Perl, and don't know exactly what regexp I can use to get IP address from 'ifconfig' routine. My system is linux, so output is the following: eth0 Link encap:Ethernet HWaddr 10:EE:0C:36:8E:C8 inet addr:192.168.11.22 Bcast:192.168.11.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:41816612 errors:0 dropped:0 overruns:0 frame:0
7
21320
by: Privacy Advocate | last post by:
//crossposted to: comp.lang.javascript, alt.comp.lang.javascript in an effort to get factual answers from JavaScript experts// Simply put; Is it possible to obtain the real (actual) IP address of someone (client) that visits a web site through an anonymous proxy if this person ONLY has JavaScript enabled in their browser? This is NOT a question about PHP, perl, VBScript, Java(.class), or ActiveX. Let us _only_ deal with JavaScript for...
1
436
by: HB2 | last post by:
Is it possible to obtain the IP address of my desktop using a Visual Basic command?
27
2256
by: Adam Warner | last post by:
Hi all, In the code snippet below I successfully determine the address of val1:* struct o val1=l_SYM_2B(&a).o; print_aesthetic(&val1); The structure o is heavyweight. I understand (hopefully correctly) that (barring compiler optimisations) C will shallow copy the structure into val1.
7
14355
by: navin123 | last post by:
Im writing a code to retirve the mac address of the client. I hv the javascript dat retrives the mac address.. but it works only id the IE's security is set to low. If it is set to high it throws an error "Automation server cant create object". Can aneonle help me on how to sign the ActiveX control??? coz i think dats what is creating the problem??/
2
1283
by: Account1 | last post by:
Im working a compiler/simulator environment which generates asm code also ( I generate it runtime ). The scheduler run in C++ which calls generated assembly code in the following way: fn_asm = ( void(*)() )p_process->asm_code->memory; // the generated asm code stored in p_process->asm_code->memory, this is a memory area fn_asm(); // calling the generated asm routine In the asm code there are calling of CBuilder routines (routines of...
0
1594
by: Danny Tsai | last post by:
Does anyone know how to get the MAC address of a computer? The computer is in different subnet and connected through a router. When I used the SendARP() function to get the MAC address, it worked when running within the same subnet. The problem is that SendARP() seems to return the MAC address of the router. I tried both arp and nbtstat commands but they only worked when running within the same subnet.
2
1447
by: mm3178 | last post by:
Hello Mates, My case is slightly complicated....please help me In order to obtain real time current balance of an account, I have built a c# windows service that invokes a c# web service recursively after every 2 secs. The web service accepts that accout number as an input parameter, invokes a stored procedure and returns the current balance of the input account no. My problem is with the performance. Invoking a webservice every 2...
0
1570
by: leonardo.schmidt | last post by:
Due to some connectivity problems with a client's VPN software, I'm developing an app that needs to obtain the current logged user's Exchange server address & add a new route (among other well-known ones) to it in the computer's table, so Outlook 2003 can work properly. Is there any easy way to obtain that address (maybe without using WMI)? TIA
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
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...
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...
1
7644
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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...
1
4316
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.