Search in Asp.Net


In this article we will see how to implement a search facility in our ASP.Net web site.


In forums I have seen questions about searching; about how to implement a search in their ASP.Net. Yes we can implement such a search facility in our ASP.Net web site for searching for a particular word on a page. For this I'm using a third party control that provides a search box and a search result to control this operation. provides such a control. Download a trial version of Search For Asp.Net from: After downloading the control it will give you a setup file. Now we will see how to install it.

Installation Of Search in Asp.Net:

Step 1:

Run the setup downloaded.

Step 2:

Follow the step-by-step installation in the manner you install other products. When the installation asks you for which .Net version you want Search Control to install specify the version you are using; it will give you three options.

  1. CLR 1.0/1.1
  2. CLR 3.0/3.5
  3. CLR 4.0

Select your version from those choices by checking the checkbox coresponding to your version; you can install all three options also if you have installed Visual Studio 2003/05/08/10. For installation you need an internet connection. In the following I've given some screens if you are facing any problem follow the option selection given in the screens.

Step 1:

Select Search Pro option given in following screen.


Step 2:

Select version shown in given screen bellow. The next two steps are for installation of the control on a LAN.


Step 3:

Finally the setup will ask you to add the control into Visual Studio. Select the version of your VS that you commonly use. It will add two controls to your Visual Studio but for this you must close all Visual Studio Instances. Follow this final screen for adding this control to your visual Studio.


Step 4:

Now you can use this control on any .aspx page. Add SearchBox control to your Asp.Net page which give you one TextBox and One Button for search. This SearchBox Contains a smart tag which will ask you a Result Page Url Specify the Result Page URL in this Smart tag. This URL normally is the URL of that page where second control i.e. Search Result you have taken.

Step 5:

Now first prepare our Result Page to show the result. In same page also you can do it just bellow SearchBox keep SearchResult control and give this SearchResult Control URL in SearchBox smarttag as explained in Step 5.

Step 6:

This SearchResult control contains one smart tag which will ask you to manage the Index Directory. If you select Directory specified by this SearchResult Control it will create IndexDirectory in your root Directory of the project.

Step 7:

This index directory will manage all URL's and if you want to perform a search in the database then some queries and some connection to database. If you want to perform a search only on a webpage then simply add the URL's on which you want to search. Follow the given screen; it will give you an idea of how to specify the URL's. In the following screen click on Import Documents/records button; it will show another screen for specifying URL's or database queries and connection.


Step 8:

Now run your project and type your query in SearchBox and Click on Search button and see the result is shown to you from the specified URL's which contain your word.


In this way you can customize search facility to your ASP.Net web site.

Similar Articles