[Link] Tutorial By Coder Baba [Link].
com/coderbaba
[Link] Tutorial-2022
Crash Course for Beginners (Complete Course)
Become ZERO to HERO in [Link]
Day 24 Agenda: Class #024
Topics (What’s in it for you)
✓ What is [Link] file
✓ What is JIT
✓ What is .NET?
1
[Link] Tutorial By Coder Baba [Link]/coderbaba
What is [Link] File?
The Microsoft .NET Framework, and [Link] in particular, uses XML-formatted “.config” files to
configure applications. [Link] files to define configuration options. The behavior of an
[Link] application is affected by different settings in the configuration files like
“[Link]” and “[Link]”.
A configuration file ([Link]) is used to manage various settings that define a website. The
settings are stored in XML files that are separate from your application code. In this way you
can configure settings independently from your code. Generally a website contains a single
[Link] file stored inside the application root directory.
If you place a [Link] file in your root directory, it will affect your entire site, if you place it
in a /content directory or folder, it will only affect that directory.
[Link]:
System-wide configuration settings for .NET Framework are defined in the [Link] file.
The [Link] file is located in the
%SystemRoot%\[Link]\Framework\%VersionNumber%\CONFIG\ folder. The default
settings that are contained in the [Link] file can be modified to affect the behavior of
Microsoft .NET applications on the whole system.
[Link]:
You can change the [Link] configuration settings for a single application if you create a [Link] file in the
root folder of the application. When you do this, the settings in the [Link] file override the settings in the
[Link] file. The [Link] file must contain only entries for configuration items that override the settings
in the [Link] file. At a minimum, the [Link] file must have the <configuration> element and the
<[Link]> element. These elements will contain individual configuration elements as following:
<?xml version="1.0" encoding="utf-8" ?>
<configuration> <[Link]> </[Link]> </configuration>
The first line of the [Link] file describes the document as XML-formatted and specifies the character
encoding type. This first line must be the same for all .config files. The lines that follow mark the beginning and the
end of the <configuration> element and the <[Link]> element of the [Link] file. By themselves, these
lines do nothing. However, the lines provide a structure that permits you to add future configuration settings. You
add the majority of the [Link] configuration settings between the <[Link]> and </[Link]> lines.
2
[Link] Tutorial By Coder Baba [Link]/coderbaba
Usage of configuration file
.config file used to describe the properties and behaviors of various aspects of
[Link] applications. Configuration files help you to manage the many settings
related to your website. Each file is an XML file (with the extension .config) that
contains a set of configuration elements. Configuration information is stored in
XML-based text files.
Benefits of XML-based Configuration files
• [Link] Configuration system is extensible and application specific
information can be stored and retrieved easily. It is human readable.
• You need not restart the web server when the settings are changed in
configuration file. [Link] automatically detects the changes and
applies them to the running [Link] application.
• You can use any standard text editor or XML parser to create and edit
[Link] configuration files.
What [Link] file contains?
There are number of important settings that can be stored in the configuration file.
Some of the most frequently used configurations, stored conveniently inside
[Link] file are:
• Database connections
• Caching settings
• Session States
• Error Handling
• Security
3
[Link] Tutorial By Coder Baba [Link]/coderbaba
Various Sections in [Link] file:
<[Link]>: this element contains information about how the [Link] hosting layer
manages application behavior.
Ex:
<[Link]>
<SessionState mode="inproc" cookieless="false" timeout="20"/>
<customErrors defaultRedirect="[Link] mode="RemoteOnly">
<error statusCode="404" redirect="[Link]
</customErrors>
</[Link]>
<[Link]>: this element contains compiler configuration settings for language
providers installed on a computer in addition to the default providers that are installed with the
.NET Framework, such as the CSharpCodeProvider and the VBCodeProvider.
<[Link]>: this element contains settings that specify how the .NET Framework connects to
the network.
<appSettings>: this element stores custom application configuration information, such as file
paths, XML Web service URLs, or any other custom configuration information for an
application. Information is stored in the <appSettings> as key/value pairs and those elements
are accessed in code using the ConfigurationSettings class.
Ex:
<configuration>
<appSettings>
<add key="loginUrl" value="~/[Link]" />
<add key="autoFormsAuthentication" value="false"/>
<add key="RetryAttempts" value="5" />
<add key="ApplicationBuildDate" value="11/4/1999 6:23 AM" />
<add key=”mobile” values=”123456789”/>
</appSettings>
</configuration>
<connectionStrings>: this element contains initialization information that is passed as a
parameter from an application to a data source. Information is stored in the
<connectionStrings> as key/value pairs and those elements are accessed in code using the
ConfigurationSettings class.
4
[Link] Tutorial By Coder Baba [Link]/coderbaba
Ex:
<connectionStrings>
<add name ="cnn" connectionString ="Initial Catalog = master;
Data Source =localhost; Integrated Security = true"/>
</connectionStrings>