The second well-developed ASP-compiled complete IP address location search class

Source: Internet
Author: User
Tags numeric numeric value
<%
Server. ScriptTimeout = & he10' & H3C
Response. Buffer = ("S. F." = "S. F .")
Dim IpSearch
'Create an object
Set IpSearch = New clsIpSearch
'Use the default connection to establish a connection to the SQL Server IP Address Library, but ensure that wry. mdb exists.
IpSearch. ConnectionString = "DRIVER = {SQL Server}; SERVER = hostname: UID = sa; PWD =; DATABASE = Ip"
'Set the IP address to be queried. The default value is available. 127.0.0.1 is set here.
IpSearch. IpAddress = & H7F & "." & H00 & "." & H00 & "." & H01
If Request. QueryString ("IP") <> "Then
If IpSearch. Valid_IP (Request. QueryString ("IP") Then
IpSearch. IpAddress = Trim (Request. QueryString ("IP "))
End If
End If
'Obtain the IP address location. There are three feedback values separated by commas (,).
The format is: the user name that provides the correct IP address information in the country or region where the local network is located.
Response. Write ("location:" & IpSearch. GetIpAddrInfo () & "<br> ")
'Retrieve the IP address
Response. Write ("IP:" & IpSearch. IpAddress & "<br> ")
'Convert the IP address to a numeric value
Response. Write ("convert IP to value:" & IpSearch. CLongIP (IpSearch. IpAddress) & "<br> ")
'Convert the IP address to a numeric value and then restore it to an IP string.
Response. Write ("restoring the value to IP:" & IpSearch. CStringIP (IpSearch. CLongIP (IpSearch. IpAddress) & "<br> ")
Response. Write ("'Here is the test code.
'Dim a, B, c, d
'For a = 0 to 255
'For B = 0 to 255 step 20
'For c = 0 to 255 step 20
'For d = 0 to 255 step 20
'Ipsearch. IpAddress = a & "." & B & "." & c & "." & d
'Response. Write ("location:" & IpSearch. GetIpAddrInfo () & "<br> ")
'Response. Write ("IP:" & IpSearch. IpAddress & "<br> ")
'Response. Write ("convert IP to value:" & IpSearch. CLongIP (IpSearch. IpAddress) & "<br> ")
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.