PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

ASP.NET Search Page and CGI

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

  • ASP.NET Search Page and CGI

    Hello, All-

    As a new person here, I appreciate the guidance I've gotten from the forum. I'd like to make a contribution of my own.

    I have a website that for many reasons MUST use .NET. Here's a summary of what I learned and how I got the thing to work, which will hopefully help out some other poor miscreant soul.

    Using: XP Professional, Visual Studio .NET 2008, Zoom 5.x

    Step 1: You can't run the CGI under "Cassini", the micro-webserver that comes with .NET. For that matter, you can't run .asp pages either. So make sure you install Microsoft IIS on your workstation before continuing. The install will create a c:\inetpub\wwwroot directory automatically.

    Step 2: For the sake of clarity, let's create a directory called "siteSearch" in the inetpub\wwwroot directory. Using the IIS Admin panel, right-click on the "siteSearch" folder, select "properties" and make sure "Execute Premissions" is set to "Scripts and Executables".

    Step 3: Do that Zoom thing (select CGI as output type), and then copy all of your files to the directory from Step 2.

    Step 4: Test it by going to http://localhost/siteSearch/search.cgi. Enter a couple of search terms to test it out. You should get results now. If not, check steps 1-3.

    Step 5: THIS HELD ME UP FOR HOURS! If you're using an ASP.NET page as directed in the FAQs on this site, DO NOT place the code in the FAQ inside your <form id=whatever runat=server></form> tags. You CAN do just about whatever else you want with the ASPX page, but if you place the code inside the form tags you WILL NOT see search results.

    Step 5 Explained: The very confusing thing is that if you do include it inside the <form> tags, you'll still see the search form and everything BUT search results. I do not know if this is true for forms that do not have the runat attribute set to "server". (I suspect not.)

    After you get it working, it's amazing.

    I hope this helps someone as much as I've been helped by all here. If I've made any misstatements or have left anything out, feel free to jump in.

  • #2
    Regarding Step 5... if you're referring to the search form, make sure to read this FAQ (at the bottom of the ASP.NET support page):

    Q. How do I create a search form on my ASPX pages?

    This explains why the normal search form would not work on ASPX pages and the alternative necessary.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment


    • #3
      Not to disagree, but....

      The point of item 5 is to not put the FAQ results code inside <form runat=server></form> tags. It will not display search results. Removing the runat=server attribute from the form tag solves the problem. It makes technical sense as I think about it, because of the way the form is executed.

      You CAN have multiple forms on an ASPX page.
      You can only have ONE form with the RUNAT=SERVER attribute.

      Provided the others don't have that attribute, you may have as many forms on the page as you like. You can even embed standard form tags inside the form that runs at the server.

      This is a good thing, because with a little bit of work search results from other ASP.NET sources can be displayed along with the ZOOM results.

      The ZOOM tag, if placed anywhere inside the form tags with the runat=server attribute, will not display results. Even if it's the only form on the page.

      So, even if one follows the example on the FAQ page (I did) but places the scripted button inside a set of <form runat=server></form> tags, the engine will not display output; at least not in my several days of experience.

      This is not articulated in the FAQ or anywhere else that I could find. I ran through this top-to-bottom and back again. Quoted code follows. Only difference is the "runat=server" tag. (Code is snipped from the FAQ)

      THIS DOESN'T DISPLAY SEARCH RESULTS FROM A .NET PAGE:

      <form runat=server>
      <%
      string paramStr = "";
      int parampos = Request.RawUrl.IndexOf("?");
      ...etc..
      Response.Write(zoom_results);
      %>
      </form>

      THIS DOES:

      <form>
      <%
      string paramStr = "";
      int parampos = Request.RawUrl.IndexOf("?");
      ...etc..
      Response.Write(zoom_results);
      %>
      </form>

      Comment


      • #4
        Sorry, I thought you meant the search form HTML when you said "the code from the FAQ". I realize now you mean the ASP.NET code to embed the CGI output.
        --Ray
        Wrensoft Web Software
        Sydney, Australia
        Zoom Search Engine

        Comment

        Working...
        X