PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

text displaying using cgi w/ ASP.NET

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

  • text displaying using cgi w/ ASP.NET

    I'm using the cgi version with ASP.NET and everything works fine, but I'm getting the following text displaying in the top left corner: 

    When I view the source, I can see where the text is in the code (right before the search template begins), but it is generated automatically and I don't know how to stop it.

    The code on the search page is as follows:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <!--
    This is the search template file (search_template.html) which contains the layout
    to your search page.

    Note that you can not access the search function from this page (by default). Instead,
    you should open or link to the search script, which is a file named "search.php",
    "search.asp", or "search.cgi".
    -->

    <body>
    <!--
    The ZOOMSEARCH tag below marks the place where your search form and search results
    will be inserted when you run the search script. By default, you do not need to place a
    search form here, the search script will generate one and display it before the search
    results. Also note that the ZOOMSEARCH tag should be on a seperate line of its own.
    -->
    <h2 class="style1"><span class="style2">Search</span><sub> </sub><br />
    <img alt="" src="images/mrk_bnr.JPG" width="435" height="10" /></h2>
    <p class="style3"><strong>Please use the following
    form to search the content of this site and locate specific
    information.</strong></p>
    <p class="style3">
    Enter one or more keywords to search for using the Search Engine.
    </p>
    <!--Zoom Search Engine Version 5.1 (1017) PRO-->
    <form method="get" action="search.aspx" class="zoom_searchform">
    Search for: <input type="text" name="zoom_query" size="20" value="" class="zoom_searchbox" />
    <input type="submit" value="Submit" class="zoom_button" />
    <span class="zoom_results_per_page">Results per page:
    <select name='zoom_per_page'><option selected="selected">10</option><option>20</option><option>50</option><option>100</option></select><br /><br /></span>
    <span class="zoom_match">Match:
    <input type="radio" name="zoom_and" value="0" checked="checked" />any search words
    <input type="radio" name="zoom_and" value="1" />all search words
    <input type="hidden" name="zoom_sort" value="0" />
    <br /><br /></span>
    </form>

    <center><p><small>Search powered by <a href="http://www.wrensoft.com/zoom/" target="_blank"><b>Zoom Search Engine</b></a></small></p></center>
    </body>


    <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">

    <head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /><title>
    Search
    </title>
    <style type="text/css">
    .highlight { background: #FFFF40; }
    .searchheading { font-size: 130%; font-weight: bold; }
    .summary { font-size: 80%; font-style: italic; }
    .suggestion { font-size: 100%; }
    .results { font-size: 100%; }
    .category { color: #999999; }
    .sorting { text-align: right; }

    .result_title { font-size: 100%; }
    .description { font-size: 100%; color: #008000; }
    .context { font-size: 100%; }
    .infoline { font-size: 80%; font-style: normal; color: #808080;}

    .zoom_searchform { font-size: 100%; }
    .zoom_results_per_page { font-size: 80%; margin-left: 10px; }
    .zoom_match { font-size: 80%; margin-left: 10px;}
    .zoom_categories { font-size: 80%; }
    .zoom_categories ul { display: inline; margin: 0px; padding: 0px;}
    .zoom_categories li { display: inline; margin-left: 15px; list-style-type: none; }

    input.zoom_button { }
    input.zoom_searchbox { }

    .result_image { float: left; display: block; }
    .result_image img { margin: 10px; width: 80px; border: 0px; }

    .result_block { margin-top: 15px; margin-bottom: 15px; clear: left; }
    .result_altblock { margin-top: 15px; margin-bottom: 15px; clear: left; }

    .result_pages { font-size: 100%; }
    .result_pagescount { font-size: 100%; }

    .searchtime { font-size: 80%; }

    .recommended
    {
    background: #DFFFBF;
    border-top: 1px dotted #808080;
    border-bottom: 1px dotted #808080;
    margin-top: 15px;
    margin-bottom: 15px;
    }
    .recommended_heading { float: right; font-weight: bold; }
    .recommend_block { margin-top: 15px; margin-bottom: 15px; clear: left; }
    .recommend_title { font-size: 100%; }
    .recommend_description { font-size: 100%; color: #008000; }
    .recommend_infoline { font-size: 80%; font-style: normal; color: #808080;}
    .style1 {
    text-align: center;
    }
    .style2 {
    font-family: Corbel;
    }
    .style3 {
    font-family: Arial, "sans serif";
    }
    </style>
    </head>

    <body>

    <form name="form1" method="post" action="search.aspx" id="form1">
    <div>
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTQxNzI1ODQ2NmRkR/X+/qubK3gkVa/ucRI/jtwv1h8=" />
    </div>

    </form>

    </body>

    </html>

  • #2
    That is a UTF-8 byte-order mark (BOM) that was inserted into the document by a program you used to edit the file with. It is not there by default nor generated by Zoom.

    If you are seeing it even after deleting the search_template.html in the output directory and re-indexing, then this means you must have modified the "search_template_src.html" in the program data folder at some point. You can do this via 'Templates'->'Customize search template'. This is used to apply permanent changes to the template file. You likely have opened this in a text editor or word processing application which added the UTF-8 BOM and then you saved the file.

    You should be able to remove it with a decent text editor. It is visible because it is not at the very start of the file.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment


    • #3
      I am seeing it after deleting the search_template.html file in the output directory and re-indexing the site, but when I open the search_template_src.html file, it doesn't show up and I've tried a few different editors.

      Could this be resolved through the method described in "UTF-8 Troubleshooting" on the faq? If so, when I try to follow those steps for the VB version, I get the following error:

      BC30311: Value of type '1-dimensional array of Byte' cannot be converted to 'Byte'

      This is in reference to the "Dim output As Byte = enc.GetBytes(zoom_results)" line of code. I also get the same error for the next line: "Response.Write(utf8enc.GetString(output))."

      Thanks for your help with this.

      Comment


      • #4
        Can you give us a URL to the search page in question?

        I noticed the HTML code you pasted in the original post is a bit of a mess - there's several <body> tags, and several <html> tag pairs. It's a little hard to tell from that alone where the problem is.

        Originally posted by Mike2321 View Post
        I am seeing it after deleting the search_template.html file in the output directory and re-indexing the site, but when I open the search_template_src.html file, it doesn't show up and I've tried a few different editors.
        Have you also checked the ASPX page you created to call the CGI?

        It is possible that it is in your "search_template.html" file and you can't see it. If the BOM is the first characters of the file, the text editor is designed to not show the BOM. Some editors like UltraEdit, feature a Hex edit mode which can show it.

        Now if this search template file is then included within your ASPX page, which outputs something before it, then the BOM will appear in the middle of the page. IE will then not recognize it as a BOM (since it did not appear at the very start of the output) and render it on screen. I'd think this is a quite likely explanation of what's happening here.

        Considering your template file doesn't appear to be UTF-8, perhaps that is the mistake. When you save the template file, make sure to save it in ASCII rather than UTF-8.

        Again, I'm only making educated guesses from the information given. What would help is seeing the actual files.

        Originally posted by Mike2321 View Post
        Could this be resolved through the method described in "UTF-8 Troubleshooting" on the faq? If so, when I try to follow those steps for the VB version, I get the following error:

        BC30311: Value of type '1-dimensional array of Byte' cannot be converted to 'Byte'

        This is in reference to the "Dim output As Byte = enc.GetBytes(zoom_results)" line of code.
        This should be:

        Code:
        Dim output As Byte[B]()[/B] = enc.GetBytes(zoom_results)
        Note the parentheses after "Byte". This solution would only help if there actually is a UTF-8 BOM saved in your template file.
        --Ray
        Wrensoft Web Software
        Sydney, Australia
        Zoom Search Engine

        Comment


        • #5
          Unfortunately, I cannot give the URL but I can post the code for all the documents that you mentioned.

          Code for search page that calls code:

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          <%@ Page Language="VB" %>
          <%@ Import Namespace="System.IO" %>
          <%@ Import Namespace="System.Diagnostics" %>
          <%

          Dim paramStr As String = ""
          Dim parampos As Integer = Request.RawUrl.IndexOf("?")
          If (parampos >= 0) Then
          paramStr = Request.RawUrl.Substring((parampos + 1))
          End If
          Dim psi As ProcessStartInfo = New ProcessStartInfo
          psi.FileName = Server.MapPath("search.cgi")
          psi.EnvironmentVariables("REQUEST_METHOD") = "GET"
          psi.EnvironmentVariables("QUERY_STRING") = paramStr
          psi.EnvironmentVariables("REMOTE_ADDR") = Request.ServerVariables("REMOTE_ADDR")
          psi.RedirectStandardInput = false
          psi.RedirectStandardOutput = true
          psi.UseShellExecute = false
          Dim proc As Process = Process.Start(psi)
          proc.StandardOutput.ReadLine
          Dim zoom_results As String = proc.StandardOutput.ReadToEnd
          ' read from stdout
          proc.WaitForExit
          ' Print the output
          Response.Write(zoom_results)
          %>
          <html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">

          <head runat="server">
          <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
          <title>Search</title>
          <style type="text/css">
          .highlight { background: #FFFF40; }
          .searchheading { font-size: 130%; font-weight: bold; }
          .summary { font-size: 80%; font-style: italic; }
          .suggestion { font-size: 100%; }
          .results { font-size: 100%; }
          .category { color: #999999; }
          .sorting { text-align: right; }

          .result_title { font-size: 100%; }
          .description { font-size: 100%; color: #008000; }
          .context { font-size: 100%; }
          .infoline { font-size: 80%; font-style: normal; color: #808080;}

          .zoom_searchform { font-size: 100%; }
          .zoom_results_per_page { font-size: 80%; margin-left: 10px; }
          .zoom_match { font-size: 80%; margin-left: 10px;}
          .zoom_categories { font-size: 80%; }
          .zoom_categories ul { display: inline; margin: 0px; padding: 0px;}
          .zoom_categories li { display: inline; margin-left: 15px; list-style-type: none; }

          input.zoom_button { }
          input.zoom_searchbox { }

          .result_image { float: left; display: block; }
          .result_image img { margin: 10px; width: 80px; border: 0px; }

          .result_block { margin-top: 15px; margin-bottom: 15px; clear: left; }
          .result_altblock { margin-top: 15px; margin-bottom: 15px; clear: left; }

          .result_pages { font-size: 100%; }
          .result_pagescount { font-size: 100%; }

          .searchtime { font-size: 80%; }

          .recommended
          {
          background: #DFFFBF;
          border-top: 1px dotted #808080;
          border-bottom: 1px dotted #808080;
          margin-top: 15px;
          margin-bottom: 15px;
          }
          .recommended_heading { float: right; font-weight: bold; }
          .recommend_block { margin-top: 15px; margin-bottom: 15px; clear: left; }
          .recommend_title { font-size: 100%; }
          .recommend_description { font-size: 100%; color: #008000; }
          .recommend_infoline { font-size: 80%; font-style: normal; color: #808080;}
          .style1 {
          text-align: center;
          }
          .style2 {
          font-family: Corbel;
          }
          .style3 {
          font-family: Arial, "sans serif";
          }
          </style>
          </head>

          <body>

          <form id="form1" runat="server">
          </form>

          </body>

          </html>

          Code for search template:

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          <!--
          This is the search template file (search_template.html) which contains the layout
          to your search page.

          Note that you can not access the search function from this page (by default). Instead,
          you should open or link to the search script, which is a file named "search.php",
          "search.asp", or "search.cgi".
          -->

          <body>
          <!--
          The ZOOMSEARCH tag below marks the place where your search form and search results
          will be inserted when you run the search script. By default, you do not need to place a
          search form here, the search script will generate one and display it before the search
          results. Also note that the ZOOMSEARCH tag should be on a seperate line of its own.
          -->
          <h2 class="style1"><span class="style2">Search</span><sub> </sub><br />
          <img alt="" src="images/mrk_bnr.JPG" width="435" height="10" /></h2>
          <p class="style3"><strong>Please use the following
          form to search the content of the site and locate specific
          information.</strong></p>
          <p class="style3">
          Enter one or more keywords to search for using the Search Engine.
          </p>
          <!--ZOOMSEARCH-->
          </body>


          Thanks again for your help with this, I'm going to try using UltraEdit with the files to see if it shows up.

          Now if this search template file is then included within your ASPX page, which outputs something before it, then the BOM will appear in the middle of the page. IE will then not recognize it as a BOM (since it did not appear at the very start of the output) and render it on screen. I'd think this is a quite likely explanation of what's happening here.
          I agree that this seems like it could be the problem. If so, would I fix it through deleting it with the editor you suggested?

          Thanks

          Comment


          • #6
            Remove the DOCTYPE declaration in your search template, and the <body>, </body> tags. Remember this template will be displayed in the middle of the ASPX page which is calling it, so it would lead to multiple DOCTYPE and body tags in the final output.

            Then save "search_template.html" in ANSI/ASCII. If you are using Notepad, you go to File->Save As and there's an "Encoding" dropdown to change from UTF-8 to ANSI. Similarly in UltraEdit (there's a "Format" dropdown) and most text editors.

            This should remove the BOM automatically. You can check this in Hex view in UltraEdit (Ctrl-H).
            --Ray
            Wrensoft Web Software
            Sydney, Australia
            Zoom Search Engine

            Comment


            • #7
              I did exactly what you said and now it works perfectly. Thanks for all your help with this.

              Comment

              Working...
              X