PDA

View Full Version : REMOTE_ADDR capture in VB Script


Neil
10-29-2002, 03:35 PM
Hi,

This is likely to be a stupid and simple question, however as cannot find the answer, it would be valuable to me.

I want to get the variable IP_ADDR to equal the REMOTE_ADDR so I can work with the IP address.

Can someone tell mee how to get

IP_ADDR = [REMOTE_ADDR]

within VB Script as I am unable to get any suyntax to be accepted.

Thanks,

Neil

cg9com
10-29-2002, 03:39 PM
can you do that in VB?
i dont know much about server side but that looks like ASP

Neil
10-29-2002, 03:51 PM
Apparently not as I was trying to use

Full_IP = Request.ServerVariables("REMOTE_ADDR")

but it kept failing.

What would you suggest I do it in.

Very new to this.

Neil

cg9com
10-29-2002, 05:59 PM
yea thats asp
i have a code to display the ip and browser/os im simple text through asp at home, but i cant think of exactly how it goes. so i dont wanna type it.

but hen i get home, lest someone else does it, i will post it up so you can compare.

redhead
10-29-2002, 06:41 PM
yea thats asp Incorrect. ASP is not a code in itself... it is a server-side method that comprises of VBScript and JavaScript. So VBScript can be ASP, so can JavaScript, but both of them have the abilty to run on a browser client side (well... not strictly true, VBScript only runs on MS Software). I'm sure whammy or mhtml will correct me if im wrong... ;)

So yes, that is VBScript.

cg9com
10-29-2002, 07:10 PM
so is it not asp? *smile*

Mhtml
10-30-2002, 02:51 AM
Someone called?;) lol

Dim Full_Ip
Full_Ip = request.servervariables("remote_addr")
response.write(Full_Ip)

That is asp, Vbscript. It does work and nothing is wrong with it. The little script will show the ip address of the current browser in their window..

This really should be in the asp forum.

cg9com
10-30-2002, 06:28 AM
this is what i was thinking.
<%IPAddress = Request.ServerVariables("REMOTE_ADDR")%><%= IPAddress %>
<%Agent = Request.ServerVariables("HTTP_USER_AGENT")%><%= Agent %>

Neil
10-30-2002, 08:35 AM
Thanks all of you.

That great.

Neil

whammy
02-17-2003, 11:53 PM
Actually, redhead, you were quite right. ;)

I see no reason the original code wouldn't work, unless perhaps Neil was using:

<% Option Explicit %>

... and didn't dimension (declare) the variable Full_IP.