473,387 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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.UserHostAddress 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.UserHostAddress are from the same PC or not?

TIA.
--
Brian Cryer
www.cryer.co.uk/brian
Oct 25 '07 #1
7 3301
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.UserHostAddress 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.UserHostAddress are from the same PC or not?

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

string ip = Request.ServerVariables("HTTP_X_FORWARDED_FOR");
if(ip != "") {
ip=Request.ServerVariables("REMOTE_ADDR");
}

Oct 25 '07 #2
"Brian Cryer" <br****@127.0.0.1.activesol.co.ukwrote in message
news:em**************@TK2MSFTNGP03.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.UserHostAddress 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.UserHostAddress 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.googlegr oups.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.UserHostAddress 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.UserHostAddress are from the same PC or
not?

first test HTTP_X_FORWARDED_FOR and if it's not available, use
REMOTE_ADDR, or Request.UserHostAddress

string ip = Request.ServerVariables("HTTP_X_FORWARDED_FOR");
if(ip != "") {
ip=Request.ServerVariables("REMOTE_ADDR");
}
Thanks Alexey. This is the best I've seen. I wasn't aware of
HTTP_X_FORWARDED_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**@markNOSPAMrae.netwrote in message
news:Ou**************@TK2MSFTNGP05.phx.gbl...
"Brian Cryer" <br****@127.0.0.1.activesol.co.ukwrote in message
news:em**************@TK2MSFTNGP03.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.UserHostAddress
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.UserHostAddress 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.UserHostAddress 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.UserHostAddress are from the same PC or not?

TIA.
--
Brian Cryer
www.cryer.co.uk/brian
Oct 25 '07 #6
"Peter Bromberg [C# MVP]" <pb*******@yahoo.yohohhoandabottleofrum.comwrote
in message news:32**********************************@microsof t.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**************@TK2MSFTNGP05.phx.gbl...
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:Ou**************@TK2MSFTNGP05.phx.gbl...
>"Brian Cryer" <br****@127.0.0.1.activesol.co.ukwrote in message
news:em**************@TK2MSFTNGP03.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.UserHostAddress
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.UserHostAddress 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
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...
7
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...
1
by: HB2 | last post by:
Is it possible to obtain the IP address of my desktop using a Visual Basic command?
27
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...
7
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...
2
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 = (...
0
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...
2
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...
0
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...

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.