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="localstart.asp,iisstart.asp,AssemblyInfo.vb,
Global.asax,Global.asax.vb,SiteSearch.aspx"
/>
<!-- Set this boolean to False if you are not using
an English language web site-->
<add key="EnglishLanguage" value="True" />
<!-- Set this to the Encoding of the web site-->
<add key="Encoding" value="utf-8" />
</appSettings>
Comments