Click to See Complete Forum and Search --> : ip address
Techno
Aug 16th, 2005, 05:55 PM
Is there a way to obtain an IP address/MAC Address of the computer currently accessing an ASP.NET website?
-TPM-
Aug 16th, 2005, 06:01 PM
Yes like this:
Request.UserHostAddress()
Techno
Aug 16th, 2005, 06:22 PM
lol thanks... there are soo many ways ive discovered of getting the IP address
however the thing is, if the user is behind a router, it will only give back the webserver the local IP address of that computer not the REAL IP... how is it possible to resolve that?
dj4uk
Aug 17th, 2005, 03:37 AM
It will only return the IP address used to connect to the server.
We have a LAN here which is attached via ADSL to the Internet. If I access a local development server (that is on the LAN) it will report my IP address as 192.168.13.54 (local IP). However if I connect to an external server it will report it as, for example, 61.125.62.134 - this is the IP address of our ADSL router.
I don't believe there is a way around this. It's a bit of a bugger if you are trying to limit by IP address because everybody on site here will report the same IP - to the server they look like the same computer.
Let me know if you have any other queries.
DJ
-TPM-
Aug 17th, 2005, 09:35 AM
Using the local ip probably wouldn't help much anyway though.
An unreal ip can easily be changed so it's not much use for security.
Different networks can have the the same subnet (ip range) so you could still get the duplicate ip's.
If you do still want it though, you could look at a client script to recover it, Java etc.
It might be easier to just use a GUID in a cookie perhaps...
Techno
Aug 17th, 2005, 09:55 AM
yeh i know but at least I have an IP which has the ISP they are using etc...
ok - what about MAC Addresses? I've been reading its pretty tough to do it, i found a way of getting the local box's mac address but not the client, so I guess some client side scripting has to be done to get the MAC Address and send it back to the server.
how do I get the client MAC Address?
-TPM-
Aug 17th, 2005, 10:06 AM
I did a quick search and didn't come up with a way to retrieve the MAC Address (I'm sure there must be a way, but it might be more hassle than it's worth). Something to point out is dialup users won't have a mac address( I know not many people are on dialup anymore, but still)
What exactly do you want the IP/MAC for? Perhaps there’s another way…
Techno
Aug 17th, 2005, 10:22 AM
there wont be another way unfortunatly.
Want to require it so I can store it in my SQL Database which tracks down users etc...
Reason being, so I can report them to the ISP/whatever for vandalizing my guestbook/website/whatever
it's to track down users who enter stuff into the guestbook. I can get the IP address no problem (Request.UserHostName/whatever) but now its getting the MAC address
as for the dial up issue - thats fine because I can give the ISP the ip address it had as well as date and time. It may be acceptable to them but prefer to have a MAC Address for non dial up users
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.