Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 120,066 times

Contents

Downloads

Related Categories

Create a Site Search Engine in ASP.NET - Site.vb and Web.config

stevanrin

Site.vb and Web.config

Site.vb

Site class consists of shared properties which store the configurations of the entire site. These properties get their values from the web.config file using the ConfigurationSettings.AppSettings.

Following are the properties of the site class:

FilesTypesToSearch Returns the files types you want to search
DynamicFilesTypesToSearch Returns dynamic files to search
BarredFolders Returns the barred folders
EnglishLanguage Returns a Boolean value whether the language is English or not.
Encoding Returns the encoding for the site
BarredFiles Returns barred files
ApplicationPath Assign and returns the path of the application
        '*************************************************
        '
        ' FilesTypesToSearch ReadOnly Property
        '
        ' Retrieve FilesTypesToSearch of the site
        '
        '*************************************************
        Public Shared ReadOnly Property FilesTypesToSearch() As String
            Get
               Return ConfigurationSettings.AppSettings("FilesTypesToSearch")
            End Get
        End Property
        
        '*************************************************
        '
        ' DynamicFilesTypesToSearch ReadOnly Property
        '
        ' Retrieve FilesTypesToSearch of the site
        '
        '*************************************************
        Public Shared ReadOnly Property DynamicFilesTypesToSearch() As String
            Get
               Return ConfigurationSettings.AppSettings("DynamicFilesTypesToSearch")
            End Get
        End Property
        '*************************************************
        '
        ' BarredFolders ReadOnly Property
        '
        ' Retrieve BarredFolders of the site
        '
        '*************************************************
        Public Shared ReadOnly Property BarredFolders() As String
            Get
               Return ConfigurationSettings.AppSettings("BarredFolders")
            End Get
        End Property

        '*************************************************
        '
        ' BarredFiles ReadOnly Property
        '
        ' Retrieve BarredFiles of the site
        '
        '*************************************************
        Public Shared ReadOnly Property BarredFiles() As String
            Get
               Return ConfigurationSettings.AppSettings("BarredFiles")
            End Get
        End Property

        '*************************************************
        '
        ' EnglishLanguage Property
        '
        ' Retrieve EnglishLanguage of the site
        '
        '*************************************************
        Public Shared ReadOnly Property EnglishLanguage() As String
            Get
               Return ConfigurationSettings.AppSettings("EnglishLanguage")
            End Get
        End Property
         
        '*********************************************************************
        '
        ' Encoding Property
        '
        ' Retreive Encoding of the site
        '
        '*********************************************************************
        Public Shared ReadOnly Property Encoding() As String
            Get
                Return ConfigurationSettings.AppSettings("Encoding")
            End Get
        End Property
		
        '**********************************************************
        '
        ' ApplicationPath Property
        '
        'Assign and retrieve ApplicationPath of the site
        '
        '**********************************************************
        Public Property ApplicationPath() As String
            Get
                Return m_ApplicationPath
            End Get
            Set(ByVal Value As String)
                m_ApplicationPath = Value
            End Set
        End Property
		

Web.config

The ASP.NET configuration system features an extensible infrastructure that enables you to define configuration settings at the time your ASP.NET applications are first deployed, so that you can add or revise configuration settings at any time, with minimal impact on operational Web applications and servers. Multiple configuration files, all named Web.config, can appear in multiple directories on an ASP.NET Web application server. Each Web.config file applies configuration settings to its own directory and all child directories below it. As mentioned earlier, the site configurations can be assigned in the web.config file.

<appSettings>

  <!-- Place the names of the files types you want searching  
  in the following line separated by commas -->

  <add key="FilesTypesToSearch" value=".htm,.html,.asp,.shtml,.aspx" 
  /> 
	<!--  Place the names of the dynamic files types you want 
  searching in the following line separated by commas -->
         
 <add key="DynamicFilesTypesToSearch" value=".asp,.shtml,.aspx" />  

  <!-- Place the names of the folders you don't  
  want searched in the following line separated by commas--> 

  <add key="BarredFolders" 
    value="aspnet_client,_private,_vti_cnf,_vti_log,_vti_pvt,_vti_script,_vti_txt,cgi_bin,_bin,bin,_notes,images,scripts" 
  />

  <!-- Place the names of the files you don't want searched in the  
  following line separated by commas include the file extension--> 

  <add key="BarredFiles" 
   value="EnglishLanguage" value="True" /> 

  <!-- Set this to the Encoding of the web site-->     
  <add key="Encoding" value="utf-8" />    

  </appSettings>

I am a Microsoft Certified Solutions Developer in .Net Architecture (MCSD.Net Early Achiever – one among the first 2500 worldwide), Microsoft Certified Application Developer in .Net – MCAD.Net (Charter Member - one among the first 5000 developers worldwide) with Microsoft certifications (MCP) in Visual basic .Net, ASP.net, XML web services, Visual Studio.Net, COM+, C# and SQL Server 2000. I have successfully completed my professional training in .Net from ExecuTrain Institute – Authorized Microsoft Technical Center, Dubai, U.A.E. I am a Science postgraduate majoring in Mathematics serving the IT industry in Dubai, U.A.E as “Dot Net Analyst Programmer/Web Administrator & Developer” for the last few years. I have hands on experience and thorough expertise in .Net technologies.

Comments

  • Re: urgent help needed

    Posted by spellstone on 28 May 2008

    hello all


    i am trying hard to integrate the search engine code but have failed, my site is on local lan server with the root folder as a virtual folder , my site is in c# , i have placed t...

  • Re: [4389] Create a Site Search Engine in ASP.NET

    Posted by shaka on 25 Jun 2007

    Do you have a version of the Search Engine project, for ASP.NET 2.0, that works well with Master Pages?

  • Re: [4389] Create a Site Search Engine in ASP.NET

    Posted by sree2000 on 02 Jun 2006

    Hello,


         I have down loaded the SearchDotNet.zip file from the code project. I am using VS2005, and asp.net 2.0  the files are not getting converted successfully...

  • please suggest me one solution

    Posted by DeepthiP on 31 Jan 2006

    when i used ur solution to implement search engine for my website it is searching only words .
    for example if hai is given it is finding some files having "hai" but if h is given it is showing " 0 f...

  • Posted by antony_cassius on 18 Jan 2006

    you can use text copy to copy images and text objects inside of SQL server
    http://www.mssqlcity.com/Articles/KnowHow/Textcopy.htm