Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get the user's IP & Name Address

Status
Not open for further replies.

Eek

Technical User
Feb 4, 2001
34
CA
First :What's the difference between
Request.ServerVariables("REMOTE_ADDR")
AND
Request.ServerVariables("REMOTE_HOST")

They both seem to return the IP of the user connecting to the site.

Second : How do I get the Name Address ( example : modemcable215.51-242-08.mc.videotron.ca ). There's a good example at : .
 
MSDN said:
REMOTE_ADDR | The IP address of the remote host that is making the request.

REMOTE_HOST | The name of the host that is making the request. If the server does not have this information, it will set REMOTE_ADDR and leave this empty.

If you wanted the name resolved from the IP address you will have to utilize some kind of reverse DNS lookup.

Try here:
[URL unfurl="true"]http://www.asp101.com/articles/jason/reversedns/default.asp[/url]
 
this ASP example uses Windows Script and I don't hink it's installed on the server hosting my page because I get an error message.

Does someone have any other idea how this can be done ?
 
You can configure IIS to perform a Reverse DNS on each request, although it is a huge performance tradeoff. It also apears like you do not have control over the server anyways.

I cannot think of any other way to do this, besides a com component, which is useless to you if you can't install it on the server.

You may be able to kludge your way around it by passing the request off to - replace 192.168.100.1 with the ip you want to lookup.

You can use the XMLHttp object to accomplish this, but you should prolly check with the site owner to make sure it is ok first.

Also, ask Jason, who wrote that article on asp101.

He is arounbd on this site too, he goes by the name jspicolli. He knows alot about this stuff.

HTH
 
lol, thanks.

I would have to agree with heymaitsme.
I would first contact your isp and ask them to install or update Wscript.

It is a pretty standard component and I have had good luck in similar scenarios in the past.

- J
 
Hi
I dont know if your would let you have access to the Windows Scripting host as that is a massive security hole.

I would go with using the XMLHttp object as it is easy once you understandind it and you can pass variables in to it so kinda in line with what you need.

Just my thoughts



Glen
Conception | Execution
 
I would have to disagree about it being a "huge Security hole".

any competent network admin is able to safely secure a server box, with or without wscript enabled.

I have written software / web apps for some of the largest brokerages in the US, and all the ones using windows have wscript enabled for one reason or another.

From an ISP's perspective, that is another story. They are vulnerable to hacks a developer writes, if the machine is not locked down properly.
But then again, that is what group policy manager is for.

Not trying to be arrogant, just my 2 cents

 
your 2 cents is worth a lot :p

Agreed any decent server admin 'can' adequatly secure a box.......till the next patch.

but to be honest it is a serious security risk when using it across trusted domains because it allow the client side execution of arbitary code across a network/server, which if not secured properly is an issue.

Not doubting that the banks are fully secured and that the intranet stuff is beyond the DMZ zone then thats fine but either ISP's or badly secured networks are SERIOUSLY vulnerable, cause if they cant do that, then they arent gonna protect themselves from SQL injection etc.

Its a grey area cause you need the functionality when developing in certain environments, however if your colo'ing or just plain hosting then its not really a vaild point.

not being a security expert i cant go to far I only have rudimentary experience.

If you host the box get some one who knows how to secure it, if not then becareful.

i think i rambled.......



Glen
Conception | Execution
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top