The ASP checks whether the IP address is private/intranet IP address source code.
Intranet/Private IP address network segment is as follows, there are 127 loopback address at the beginning:
10.0.0.0-10.255.255.255
172.16.0.0-172.31.255.255
192.168.0.0-192.168.255.255
Implementation code:
<% function Iptonumber (IP) ' IP address to digital arr=split (IP, ".") IPTONUMBER=256*256*256*CLNG (arr (0)) +256*256*clng (arr (1)) +256*CLNG (arr (2)) +CLNG (arr (3)) End Function function ISPRIVATEIP (IP) ' Determines whether the given IP address is intranet/private IP address if InStr (IP, "127.") =1 Then ' loopback IP address isprivateip=true:exit function End If Abegin=iptonumber ("10.0.0.0"): Aend=iptonumber ("10.255.255.255") ' Class A private IP address bbegin=iptonumber (' 172.16.0.0 '): Bend=iptonumber ("172.31.255.255") ' Class B private IP address Cbegin=iptonumber (" 192.168.0.0 "): Cend=iptonumber (" 192.168.255.255 ") ' Class C Private IP address Ipnum=iptonumber (IP) isprivateip= (Abegin<=ipnum and Ipnum<=aend) or (Bbegin<=ipnum and Ipnum<=bend) or (Cbegin<=ipnum and ipnum<=cend) End Function RESPONSE.W Rite Isprivateip ("11.255.255.255") & "<br>" False Response.Write Isprivateip ("182.255.255.255") & "< Br> ' false Response.Write Isprivateip (' 172.30.255.255 ') & ' <br> ' True Response.Write Isprivateip (" 192.168.205.2 ") &" <br> "True Response.Write Isprivateip (" 127.168.205.2 ") ' True%&Gt