Link to home
Start Free TrialLog in
Avatar of jolhan
jolhan

asked on

I need a piece of code (using pure VB6 code) to extract the IP address from an IPv6 IP address

I am testing my website on Vista and need a visual basic function (used in classic asp)  to extract the IP address from an Ipv6 address.
Thanks
Avatar of TreyH
TreyH
Flag of United States of America image

Havn't tested it but I believe the return values for the ServerVariables will depend upon whether or not IPv6 is enabled on IIS and whether or not the http request is coming from a system that has IPv6 enabled.

<%

Dim strServername, strLocalname, strServerIP

strServername = UCase(Request.ServerVariables("SERVER_NAME"))   ' Server's name
strServerIP = UCase(Request.ServerVariables("LOCAL_ADDR"))      ' Server's IP address
strRemoteIP =  UCase(Request.ServerVariables("REMOTE_ADDR"))    ' Client's IP address

Response.write "Server Name = "  &  strServername
Response.write "<br>"
Response.write "Local Addr = "  &  strServerIP
Response.write "<br>"
Response.write "Remote Addr = "  &  strRemoteIP

%>
Avatar of jolhan
jolhan

ASKER

The proiblem is that with IPV6 I'm getting with the REMOTE_ADDR the new address format like: 2001:0db8:85a3:08d3:1319:8a2e:0370:7348.
From this address I need to extract the IP address like 123.456.78.910
ASKER CERTIFIED SOLUTION
Avatar of TreyH
TreyH
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial