PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

Translation of the WScript in SSI with ASP & CGI

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Translation of the WScript in SSI with ASP & CGI

    hi,

    I have tried using your WScript in my ASP search page with the search.cgi as suggested here http://www.wrensoft.com/zoom/support/faq_ssi.html:

    Code:
    <%
    Dim WshShell, env
    Set WshShell = CreateObject&#40;"WScript.Shell"&#41;
    Set env = WshShell.Environment&#40;"Process"&#41;
    env.Item&#40;"REQUEST_METHOD"&#41; = "GET"
    env.Item&#40;"QUERY_STRING"&#41; = Request.QueryString
    set oExec = WshShell.Exec&#40;Server.MapPath&#40;"search.cgi"&#41;&#41;
    oExec.StdOut.ReadLine&#40;&#41; ' skip the HTTP header line
    Response.Write&#40;oExec.StdOut.ReadAll&#40;&#41;&#41;
    %>
    But this doesn't work since my clients web server (actually the CMS-system) doesn't seem to support WScript. It does however work nicely with JScript and VBScript. Would it be possible to have this code-snippet translated into one of the above?

    Thanks.

  • #2
    The example code given above is actually in VBScript.

    The "WScript" referenced in the code is an object that is normally accessible from within VBScript. Here is some additional information:
    http://www.microsoft.com/technet/scr..._wsh_crve.mspx

    AFAIK, this is the most typical and recommended way to allow VBScript (or JScript) to execute an external application/process such as the CGI.

    It is possible that your web server is configured to restrict access to the WSH (Windows Script Host). We would recommend checking with your server admin or webhost and requesting access.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment


    • #3
      thanks for your reply!

      My problem with the current script was that I got this error message:

      Type mismatch: 'env.Item':
      env.Item("QUERY_STRING") = Request.QueryString

      I took a stab at adding the value field to the querystring, and that made it work!

      Code:
      Dim WshShell, env
      Set WshShell = CreateObject&#40;"WScript.Shell"&#41;
      Set env = WshShell.Environment&#40;"Process"&#41;
      env.Item&#40;"REQUEST_METHOD"&#41; = "GET" 
      env.Item&#40;"QUERY_STRING"&#41; = Request.QueryString.Item&#40;"zoom_query"&#41;
      set oExec = WshShell.Exec&#40;Server.MapPath&#40;"search.cgi"&#41;&#41; 
      oExec.StdOut.ReadLine&#40;&#41; ' skip the HTTP header line
      Response.Write&#40;oExec.StdOut.ReadAll&#40;&#41;&#41;

      Comment

      Working...
      X