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.
Visual Basic Classic

Avatar of undefined
Last Comment

8/22/2022 - Mon

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


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

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck