ASP Configue file

ASP.NET WEB & MACHINE CONFIGUE FILE

0  0 2016-03-15 10:00:07

The behavior of Asp.Net application is affected by different type of setting in configuration files.
1.  Web.Config
2.  Machine.config

machine.config file contains default & the machine-specific value for all supported settings in application. This machine setting is controlled by applications which are not generally given access to this file & system administrator. The application contains child directories it define where the web.config file is available. And web.config file for each folder in root folder.

The Web.config file are not only for securing to your application but also for wide range of other purposes which it is intended for the Asp.Net Web.config file provides you a flexible way to handle  your requirements at application level.

Following is the code for snippet that shows basic syntax of a configuration file:
<configuration> 
    /* Configuration section-handler declaration area.*/
<configSections>
    <section name="First" type=" FirstHandler" />                  
    <section name="Second" type=" SecondHandler" />     
</configSections>

   /* Configuration section settings area. */
<section1>
      <s1Setting1 attribute1="attr1" />
</section1>

<section2>
      <s2Setting1 attribute1="attr1" />
</section2>

   <system.web>
      <authentication mode="Windows" />
   </system.web>
</configuration>

1.) Application Settings :-
Application settings allow storing application to wide name value pairs for read only access.
Example, we can define custom application setting such as:-

<configuration>
   <appSettings>
      <add key="App Name" value="MyApp"/> 
   </appSettings>
</configuration>

<configuration>
  <appSettings>
      <add key="appISBN" value="0-234-54231-9" />
      <add key="appBook" value="ASP.NET" />
  </appSettings>
</configuration>

2.) Connection Strings:-
The connection strings show which database connection strings are available to the website.

<connectionStrings>
    <add name="ASPDotNetConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=E:\\projects\datacaching\datacaching\App_Data\ASPDotNet.mdb"  providerName="System.Data.OleDb" />
    <add name="NewBookConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\ \databinding\App_Data\NewBook.mdb" providerName="System.Data.OleDb" />
</connectionStrings>

 

Comments (0)

Post Your Comments

Headquarter



Hong Kong Office



Find Us On

Ziuby
Ziuby