PassMark Logo
Home » Forum

Use in ASP templates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bobgarrett
    Junior Member
    • Dec 2012
    • 6

    #1

    Use in ASP templates

    We have implemented the search engine and embedded results in an asp page using the following code
    <%
    Dim WshShell, env, oExec
    Set WshShell = CreateObject("WScript.Shell")
    Set env = WshShell.Environment("Process")
    env.Item("REQUEST_METHOD") = "GET"
    env.Item("QUERY_STRING") = Request.QueryString
    env.Item("REMOTE_ADDR") = Request.ServerVariables("REMOTE_ADDR")
    set oExec = WshShell.Exec(Server.MapPath("search.cgi"))
    oExec.StdOut.ReadLine() ' skip the HTTP header line
    Response.Write(oExec.StdOut.ReadAll())
    %>

    This is working and producing the first page of results in the expected page, format and style.
    However, the links for results pages 2,3 etc are not pointing at the asp page but at the cgi script. How can we correct this?
    Many thanks
  • Richard
    Administrator
    • May 2010
    • 161

    #2
    The code you provided seems to be from our FAQ page, Q. How do I use SSI or server-side scripting with the CGI version?

    In this FAQ, under the "You will also have to:" section it mentions that you need to provide a "LinkBack URL" for the search to work correctly.

    "Specify the "LinkBack URL" setting in the indexer configuration window (under the "Advanced" tab). This will allow links generated by the CGI (eg. for "Next page of results", etc.) to point to the file where you have pasted the above code, rather than the CGI itself. For example, if you have included the above code in "mysearch.asp", then you specify "mysearch.asp" as your LinkBack URL."

    Comment

    • bobgarrett
      Junior Member
      • Dec 2012
      • 6

      #3
      We have done that but the link appearing on the page for subsequent pages is changed to the right directory but still pointing to the cgi file.

      Thus the first search results page is http://www.excitech.co.uk/useradmin/search-results.asp?zoom_query=autocad I have included the full URL inc the query.
      Then the link for the second page is http://www.excitech.co.uk/useradmin/search.cgi?zoom_query=autocad&zoom_page=2&zoom_per _page=10&zoom_and=0&zoom_sort=0&zoom_xml=0

      The cgi file is not in that folder and we want to call the asp page. Is there something else we have overlooked?
      Thanks

      Comment

      • bobgarrett
        Junior Member
        • Dec 2012
        • 6

        #4
        We have done as you suggested but the second page link is now referring to the cgi file rather than the asp file despite having given the asp file in the Linkback reference.
        So the first page is, for example, /useradmin/search-results.asp?zoom_query=autocad but the link to the second page is
        /useradmin/search.cgi?zoom_query=autocad&zoom_page=2&zoom_per _page=10&zoom_and=0&zoom_sort=0&zoom_xml=0

        Have we overlooked something else?

        Thanks

        Comment

        • David
          Administrator
          • Dec 2004
          • 4714

          #5
          After changing the link back URL, you also need to re-index the site and upload a new set of index files before the changes will come into effect.

          Comment

          • bobgarrett
            Junior Member
            • Dec 2012
            • 6

            #6
            Excellent. Thanks

            Comment

            Working...