Product DocsMenu

Coveo Platform 7.0 >
Administrator Help > Coveo .NET Front-End 12.0 > Integrating a Search Hub in ASP

Integrating a .NET Search Hub in ASP

The Coveo .NET Front-End search hub is referenced in the default document defined in IIS for your Coveo search website.

Example: When you install CES in the default installation folder, the installer creates the default Coveo Enterprise Search 7 website, the default document defined in IIS for the website is the C:\Program Files\Coveo .NET Front-End 12\Web\Coveo\default.aspx file and the default search hub is referenced in this file by the <ces:SearchHub id="h" runat="server"/> code line.

When you create a new search hub, you can use it by referencing it in the default document defined in IIS for your website or in other custom ASP pages that you may want to create and use in other contexts.

To integrate a Coveo search hub to an ASP.NET page

  1. Using an administrator account, connect to the server for the website in which you want to integrate the Coveo search hub.

  2. Using a text editor:

    1. Open the .aspx file for the ASP.NET page in which you want to integrate the Coveo search hub.

    2. Add or ensure that the following declaration appears after the @page directive.

      <%@ Register TagPrefix="ces" Namespace="Coveo.CES.Web.Search.Controls" Assembly="Coveo.CES.Web.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=44110d16825221f2" %>  
    3. Locate the place where the search hub is to be inserted (such as after the custom page headers) and add or edit the following control:

      <ces:SearchHub Name="MyHubName" runat="server"/>  

      where you replace MyHubName by the name of your search hub.

      Note: The ces:SearchHub control must be inserted in the ASPX page in the existing <form> node, or in a unique new one if none exists.

    4. Save the modifications.

  3. In IIS, for the site containing the page in which you integrate the search hub, create a virtual folder named Coveo that points to the [.Net_Front-End_Path]\Web\Coveo folder (see the Microsoft document Create a Virtual Directory (IIS 7)).

  4. Using a text editor:

    1. Open the web.config file of the site in which you are integrating the Coveo search hub.

    2. Add the following definitions to the Configuration > ConfigSections section.

      <sectionGroup name="coveoCnlWeb">
        <section name="customContent" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </sectionGroup>
      <sectionGroup name="coveoEnterpriseSearch">
        <section name="database" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <section name="analytics" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <section name="locations" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <section name="server" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </sectionGroup>  
    3. In the configuration\configSections section, add the following code:

      <sectionGroup name="coveoCnlWeb">
        <section name="customContent" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </sectionGroup>
      <sectionGroup name="coveoEnterpriseSearch">
        <section name="database" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <section name="analytics" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <section name="locations" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
        <section name="server" type="System.Configuration.SingleTagSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
      </sectionGroup>
    4. In the configuration\system.web\pages section, add the following code:

      <controls>
        <add tagPrefix="cnla" namespace="Coveo.CNL.Web.Ajax" assembly="Coveo.CNL.Web, Version=12.0.0.0, Culture=neutral, PublicKeyToken=44110d16825221f2" />
        <add tagPrefix="cnlb" namespace="Coveo.CNL.Web.BetterControls" assembly="Coveo.CNL.Web, Version=12.0.0.0, Culture=neutral, PublicKeyToken=44110d16825221f2" />
        <add tagPrefix="cnlm" namespace="Coveo.CNL.Web.Misc" assembly="Coveo.CNL.Web, Version=12.0.0.0, Culture=neutral, PublicKeyToken=44110d16825221f2" />
        <add tagPrefix="cnlv" namespace="Coveo.CNL.Web.Validators" assembly="Coveo.CNL.Web, Version=12.0.0.0, Culture=neutral, PublicKeyToken=44110d16825221f2" />
        <add tagPrefix="cnlvs" namespace="Coveo.CNL.Web.Validators.ServerSide" assembly="Coveo.CNL.Web, Version=12.0.0.0, Culture=neutral, PublicKeyToken=44110d16825221f2" />
        <add tagPrefix="cnlw" namespace="Coveo.CNL.Web.Widgets" assembly="Coveo.CNL.Web, Version=12.0.0.0, Culture=neutral, PublicKeyToken=44110d16825221f2" />
        <add tagPrefix="ces" namespace="Coveo.CES.Web.Search.Controls" assembly="Coveo.CES.Web.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=44110d16825221f2" />
        <add tagPrefix="cs" namespace="Coveo.CES.Web.Search.Controls.CustomerService" assembly="Coveo.CES.Web.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=44110d16825221f2" />
      </controls>
      <namespaces>
        <add namespace="Coveo.CES.Web.Search" />
        <add namespace="Coveo.CES.Web.Search.Controls" />
        <add namespace="Coveo.CNL.Web" />
      </namespaces>
    5. In the configuration\system.web\compilation section, add the following code:

      <assemblies>
        <add assembly="Coveo.CNL, Version=12.0.0.0, Culture=neutral, PublicKeyToken=44110d16825221f2" />
        <add assembly="Coveo.CNL.Web, Version=12.0.0.0, Culture=neutral, PublicKeyToken=44110d16825221f2" />
        <add assembly="Coveo.CES.Common, Version=12.0.0.0, Culture=neutral, PublicKeyToken=44110d16825221f2" />
        <add assembly="Coveo.CES.Web.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=44110d16825221f2" />
      </assemblies>
    6. In the configuration section, add the following code:

      <coveoCnlWeb>
        <customContent uri="~/Coveo/" anonymousUri="~/Coveo/Anonymous/" />
      </coveoCnlWeb>
      <coveoEnterpriseSearch>
        <server hostname="localhost" port="52800" servicesHostname="localhost" servicesPort="52810" instance="default" mirrorName="default" sslCertificatePath="C:\Program Files\Coveo .NET Front-End 12\Web\certificate.p12" />
        <database enabled="false" connectionString="mongodb://localhost/databaseName" />
        <analytics enabled="false" connectionString="Data Source=yourServerName;Initial Catalog=CoveoAnalytics;Integrated Security=SSPI;" />
      </coveoEnterpriseSearch>
    7. Save the file.

  5. Using a browser, access the modified page to attempt to view the search hub.

    The Front-End Server Configuration first time setup page appears to allow you to complete the installation (see Coveo .NET Front-End First Time Setup).

People who viewed this topic also viewed