Using ASP programming to find an example quickly

Source: Internet
Author: User
The first step you want to make is to create an initial variable in the Global.asa file and place it in your sub Session_OnStart () program.

Sub Session_OnStart ()
Referer = Trim (Request.ServerVariables ("Http_referer"))
If Referer = "" Then
Referer = "None"
End If
Session ("Referer") = Referer
End Sub

Then let's take a look at how to complete the main function of the program.

Because the URL is encoded, the first thing to do is to restore the visitor's host data to something useful to us. Create an ASP page, call it decode.asp, is the backbone of our program. The first function is to decode the encoded pointing head. The program is a bit long, and very direct, there is no roundabout, if you are too troublesome, as to www.popunet.com "nets bug refresher Course" above find this article, with "Copy/paste" Dafa bar.

Source

The second thing to do is to isolate the part of the query from the header of the URL--this is what we need.
' Detach the query field from point to URL.

Function isproduct (PSTR)
If pstr <> "" and LCase (PSTR) <> "None" Then
' Search Backward field
temp = InStrRev (pstr, "/")
' Get the location of directory separation
TempStr = right (pstr, temp)
' Get relevant data length
Temp2 = Len (PSTR)
' Get the query data row
Pstr = Mid (pstr, temp, TEMP2)
' Set the value of the return function
Isproduct = Pstr
Else
Isproduct = ""
End If
End Function

The next is to establish a clear standard for finding. To achieve this, create two static spaces. Find points to data
Function Finder (ByRef prodlist, ByVal reflist)
' Fuzzy query
reflist = LCase (reflist)
' Loop through the pointer to find the matching field
For i = 0 to UBound (prodlist)-1
If inStr (reflist, LCase (prodlist (i, 0)) Then
' Find a match
Tholder = Tholder & "Are You Looking for" _
& "" _
& Prodlist (i, 0) & "
"
End If
' Second cycle
Next
' Returns the result
Finder = Tholderend Function

Through a inclue, we put our good decode.asp to any page that needs this function, and we're done.
Specifically as follows:

' If the pointing header is not empty, call this feature if LCase (Session ("Referer")) <> "None" OR session ("Referer") <> "Then" parsing points to data Response.Write VbCrLf & "

"_ & Finder (Parray, UrlDecode (isproduct (" Referer ")) _ &"
"& VbCrLf
End If (Popular network newspaper/karry)



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.